[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #4230 [Tor Client]: smartlist_ensure_capacity contains bogus overflow check



#4230: smartlist_ensure_capacity contains bogus overflow check
------------------------+---------------------------------------------------
 Reporter:  rransom     |          Owner:                    
     Type:  defect      |         Status:  new               
 Priority:  major       |      Milestone:  Tor: 0.2.1.x-final
Component:  Tor Client  |        Version:                    
 Keywords:              |         Parent:                    
   Points:              |   Actualpoints:                    
------------------------+---------------------------------------------------
 In `smartlist_ensure_capacity`, in src/common/container.c:
 {{{
   if (size > sl->capacity) {
     int higher = sl->capacity * 2;
     while (size > higher)
       higher *= 2;
     tor_assert(higher > 0); /* detect overflow */
 }}}

 Overflow of a signed integer produces undefined results.  I would be
 surprised if GCC doesn't optimize this comparison out, just for the sake
 of conjuring nasal demons at people who don't code with a copy of the C
 âstandardâ at hand.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/4230>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs