[tor-bugs] #30920 [Core Tor/Tor]: Detect uint64 overflow in config_parse_units()

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Sep 23 05:41:19 UTC 2019


#30920: Detect uint64 overflow in config_parse_units()
---------------------------+------------------------------------
 Reporter:  nickm          |          Owner:  (none)
     Type:  defect         |         Status:  new
 Priority:  Low            |      Milestone:  Tor: 0.4.3.x-final
Component:  Core Tor/Tor   |        Version:
 Severity:  Minor          |     Resolution:
 Keywords:  easy overflow  |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------------------

Comment (by teor):

 Replying to [comment:15 guigom]:
 > The SSIZE_MAX part may be interfering with 64bit arithmetic in 32bit
 machines as seen in this error in AppVeyor build.
 >
 >
 [https://ci.appveyor.com/project/torproject/tor/builds/27495711/job/049andnqliomgw0u#L6029]
 >
 > Tomorrow (CEST) I'll test with UINT64_MAX.

 You're right, SSIZE_MAX is 2^31^ on 32-bit platforms, which would be a
 valid value for bandwidth on 32-bit machines. And memory on machines that
 allow processes to take up more than 2 GB.

 Let's check that the value is less than INT64_MAX?
 And let's check the result of the float multiplication, *before* we cast
 it to a uint64_t.
 (We want to use a value that's significantly lower than UINT64_MAX, so
 that floating point calculations can't change the result.)

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


More information about the tor-bugs mailing list