[tor-bugs] #27709 [Core Tor/Tor]: The compiler doesn't warn about tor_assert(a = b)

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Sep 14 14:55:08 UTC 2018


#27709: The compiler doesn't warn about tor_assert(a = b)
------------------------------+--------------------------------
     Reporter:  nickm         |      Owner:  (none)
         Type:  defect        |     Status:  new
     Priority:  High          |  Milestone:  Tor: 0.3.5.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------------
 C's assignment expressions are notoriously easy to mis-type when you are
 trying to enter an equality expression instead.  Most compilers will
 notice when you say something like `if (a = b)`, and make you add an extra
 set of parentheses.  But we've done something with our tor_assert() macro
 so this doesn't happen. We should fix that.

 Found from ahf's review of #27289

 We should also make sure BUG doesn't have this problem.

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


More information about the tor-bugs mailing list