[tor-bugs] #19063 [Core Tor/Tor]: The tor_parse_* functions should check and warn on max < min

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon May 16 07:13:29 UTC 2016


#19063: The tor_parse_* functions should check and warn on max < min
------------------------------+--------------------------
     Reporter:  teor          |      Owner:
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.2.???
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  easy
Actual Points:                |  Parent ID:
       Points:  small         |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------
 If a developer mistakenly calls:
 {{{
 tor_parse_long(value, 10, 1, UINT32_MAX, NULL, NULL);
 }}}

 It effectively becomes:
 {{{
 tor_parse_long(value, 10, 1, -1, NULL, NULL);
 }}}

 We can detect this by making sure `min <= max`, and warning if that's not
 the case. (I really don't think we should assert.)
 We should do this for all similar tor_parse_* functions.

 But are there any circumstances where we should allow min to be greater
 than max? (it will always fail)
 Existing callers pass constants to this function, so it's not going to
 trigger for them.

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


More information about the tor-bugs mailing list