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

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Jul 23 20:06:33 UTC 2019


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

Comment (by guigom):

 Replying to [comment:7 teor]:

 Hi teor, #30864 has been merged and I have a couple of questions.

 Nick added a couple of commented out tests in which it is expected for
 config_parse_memunit (and thus config_parse_units) to return 0 instead of
 UINT64_MAX when detecting 64-bit overflow.

 {{{
 // tt_u64_op(config_parse_memunit("20000000 TB", &ok), OP_EQ, 0);
 // tt_assert(!ok);
 }}}

 Is this the expected behavior, or should it fallback to UINT64_MAX?

 ----

 In case of using the nowrap mul function inside
 unitparse.c:config_parse_units

 `make check-includes` tells that it is forbidden to include muldiv.h
 inside unitparse.c

 Should `lib/intmath/*.h` be appended to confmgt .may_include?

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


More information about the tor-bugs mailing list