[haiku-bugs] Re: [Haiku] #11111: Division by zero in TabDecorator CID 1210846

  • From: "kallisti5" <trac@xxxxxxxxxxxx>
  • Date: Thu, 07 Aug 2014 21:32:23 -0000

#11111: Division by zero in TabDecorator CID 1210846
-------------------------+----------------------------
   Reporter:  kallisti5  |      Owner:  nobody
       Type:  bug        |     Status:  new
   Priority:  normal     |  Milestone:  R1/alpha5
  Component:  - General  |    Version:  R1/Development
 Resolution:             |   Keywords:
 Blocked By:             |   Blocking:
Has a Patch:  0          |   Platform:  All
-------------------------+----------------------------
Description changed by kallisti5:

Old description:

> Per CID 1210846, there is a potential division by zero...
>
> http://cgit.haiku-
> os.org/haiku/tree/src/servers/app/decorator/TabDecorator.cpp#n431
>
> In TabDecorator::_DistributeTabSize(float delta)
> {{{
> int32 nTabsWithMaxSize = 0;
> .
> .
> for (int32 i = 0; i < fTabList.CountItems(); i++) {
>   (make nTabsWithMaxSize larger)
> }
> .
> .
> minus /= nTabsWithMaxSize;
> }}}
>
> I don't have the time to study the code and fix it, but it was a big
> enough issue I decided it needed a ticket.

New description:

 Per CID 1210846, there is a potential division by zero...

 http://cgit.haiku-
 os.org/haiku/tree/src/servers/app/decorator/TabDecorator.cpp#n431

 In TabDecorator::_DistributeTabSize(float delta)
 {{{
 int32 nTabsWithMaxSize = 0;
 .
 .
 for (int32 i = 0; i < fTabList.CountItems(); i++) {
   (make nTabsWithMaxSize larger)
 }
 .
 .
 minus /= nTabsWithMaxSize;
 }}}

 I don't have the time to study the code and fix it, but it was a big
 enough issue I decided it needed a ticket. If fTabList.CountItems() is 0,
 the code will divide by 0

--

--
Ticket URL: <https://dev.haiku-os.org/ticket/11111#comment:1>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: