[tor-bugs] #10046 [Analysis]: tor-0.2.3.25/src/or/transports.c:330: possible bad assert ?

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Oct 29 17:35:49 UTC 2013


#10046: tor-0.2.3.25/src/or/transports.c:330: possible bad assert ?
--------------------------+----------------------------------------
     Reporter:  dcb       |      Owner:
         Type:  defect    |     Status:  new
     Priority:  normal    |  Milestone:  Tor: 0.2.5.x-final
    Component:  Analysis  |    Version:
   Resolution:            |   Keywords:  tor-client pt 024-backport
Actual Points:            |  Parent ID:
       Points:            |
--------------------------+----------------------------------------
Changes (by nickm):

 * keywords:   => tor-client pt 024-backport
 * cc: asn (added)


Old description:

> I just tried to compile tor-0.2.3.25 with Linux gcc compiler flag
> -Wlogical-op
>
> It said
>
> transports.c:330:5: warning: logical 'or' of collectively exhaustive
> tests is always true [-Wlogical-op]
>
> Source code is
>
>     tor_assert(mp->conf_state != PT_PROTO_BROKEN ||
>                mp->conf_state != PT_PROTO_FAILED_LAUNCH);
>
> Suggest swap || for &&

New description:

 I just tried to compile tor-0.2.3.25 with Linux gcc compiler flag
 -Wlogical-op

 It said

 transports.c:330:5: warning: logical 'or' of collectively exhaustive tests
 is always true [-Wlogical-op]

 Source code is

     tor_assert(mp->conf_state != PT_PROTO_BROKEN ||
                mp->conf_state != PT_PROTO_FAILED_LAUNCH);

 Suggest swap `||` for &&

--

Comment:

 Looks like should add -Wlogical-op to our big list of warnings.  (It's
 available in GCC 4.3 or later, it seems.)

 George, is && correct here?

 I'll suggest trying this out in 0.2.5 and considering it for backport if
 the assertion doesn't trigger.

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


More information about the tor-bugs mailing list