[tor-bugs] #13393 [Tor]: Avoid signed overflow in format_time_interval, add unit tests

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Oct 12 09:42:16 UTC 2014


#13393: Avoid signed overflow in format_time_interval, add unit tests
------------------------+----------------------------------
 Reporter:  teor        |          Owner:
     Type:  defect      |         Status:  new
 Priority:  normal      |      Milestone:
Component:  Tor         |        Version:  Tor: unspecified
 Keywords:  tor-router  |  Actual Points:
Parent ID:              |         Points:
------------------------+----------------------------------
 I've discovered a signed overflow in format_time_interval while writing
 unit tests for it.

 The signed overflow occurs when the function takes the absolute value of
 LONG_MIN (which is unlikely in practice). To avoid the overflow, I've
 patched it to use LONG_MAX when format_time_interval is passed LONG_MIN.
 (This doesn't change the output at all, as seconds aren't printed in this
 case.)

 I've also created comprehensive unit tests.

 tor version: 2.6.0-alpha
 tor git: f94e5f2e5212034cb8b2666716eeaa61e874065b

 I'll post the GitHub branch after I've created the changes file.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13393>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list