[tor-bugs] #26269 [Core Tor/Tor]: new compiler warning src/or/router.c:2034:36: warning: potential null pointer dereference

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Jun 12 00:59:49 UTC 2018


#26269: new compiler warning src/or/router.c:2034:36: warning: potential null
pointer dereference
--------------------------+------------------------------------
 Reporter:  toralf        |          Owner:  (none)
     Type:  defect        |         Status:  new
 Priority:  Medium        |      Milestone:  Tor: 0.3.4.x-final
Component:  Core Tor/Tor  |        Version:  Tor: 0.3.4.1-alpha
 Severity:  Normal        |     Resolution:
 Keywords:  034-must      |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by sysrqb):

 Replying to [comment:3 sysrqb]:
 > Replying to [ticket:26269 toralf]:
 > > {{{
 > > src/or/router.c: In function ‘check_descriptor_ipaddress_changed’:
 > > src/or/router.c:2696:8: warning: potential null pointer dereference
 [-Wnull-dereference]
 > >    prev = router_get_my_routerinfo()->addr;
 > >    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 > > src/or/router.c:2696:8: warning: potential null pointer dereference
 [-Wnull-dereference]
 > > src/or/router.c:2696:8: warning: potential null pointer dereference
 [-Wnull-dereference]
 >
 > These are actually (most likely) okay because there are null-checks
 preceding each dereference.

 Okay, I looked at the asm and it looks okay (basically
 router_get_my_routerinfo_with_err gets inlined into each
 router_get_my_routerinfo() call). I believe this warning is generated
 because this is a time-of-check-time-of-use violation. Given that tor is
 single threaded in this logic, this should not be triggerable - but it may
 be better to adjust the null-checks so this isn't theoretically possible.

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


More information about the tor-bugs mailing list