[tor-bugs] #23583 [- Select a component]: ext/timeouts/timeout-bitops.c:234: bad shift

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 19 16:05:31 UTC 2017


#23583: ext/timeouts/timeout-bitops.c:234: bad shift
--------------------------------------+--------------------
     Reporter:  dcb314@…              |      Owner:  (none)
         Type:  defect                |     Status:  new
     Priority:  Medium                |  Milestone:
    Component:  - Select a component  |    Version:
     Severity:  Normal                |   Keywords:
Actual Points:                        |  Parent ID:
       Points:                        |   Reviewer:
      Sponsor:                        |
--------------------------------------+--------------------
 tor-0.3.1.7/src/ext/timeouts/timeout-bitops.c:234]: (error) Shifting
 31-bit value by 63 bits is undefined behaviour

 Source code is

     for (i = 0; i <= 63; ++i) {
         uint64_t x = 1 << i;

 If you are going to shift something by 60+ bits reliably,
 you need 1UL, not 1.

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


More information about the tor-bugs mailing list