#6827: UB in rend_parse_v2_service_descriptor()
-----------------------+----------------------------------------------------
 Reporter:  asn        |          Owner:                    
     Type:  defect     |         Status:  new               
 Priority:  normal     |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor Relay  |        Version:                    
 Keywords:             |         Parent:                    
   Points:             |   Actualpoints:                    
-----------------------+----------------------------------------------------

Comment(by rransom):

 Replying to [comment:1 nickm]:
 > Seems harmless at first glance; if version is greater than the width of
 protocols, then we'll just ignore the value.  But AFAIK, we should also
 never actually use the value if it describes a protocol we can't speak, so
 our failure to record it shouldn't matter.
 >
 > So the desired behavior (ignore protocols we can't speak) would seem
 identical to the current behavior.

 The current behaviour on at least one computer (with 8-bit bytes) that I
 have had is `result->protocols |= (1 << (version %
 (sizeof(result->protocols) * 8)));`.

 Shifting left by more bits at once than an integer has really does produce
 undefined behaviour (‘UB’).

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6827#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Reply via email to