[tor-bugs] #4229 [Tor Client]: smartlist_len returns a (signed) int

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Sun Oct 16 23:14:24 UTC 2011


#4229: smartlist_len returns a (signed) int
------------------------+---------------------------------------------------
 Reporter:  rransom     |          Owner:                    
     Type:  defect      |         Status:  new               
 Priority:  major       |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor Client  |        Version:                    
 Keywords:              |         Parent:                    
   Points:              |   Actualpoints:                    
------------------------+---------------------------------------------------

Comment(by mansour):

 Replying to [comment:2 rransom]:
 > It's also not quite clear what we want to do for lengths in general --
 do we sometimes use negative return values to indicate failure of a
 function that would normally return a length?  At the very least, we need
 safe (overflow-checking) unsigned-to-signed and signed-to-unsigned cast
 macros.

 One approach is to pass a pointer to where "returned" lengths will be
 stored as an argument, and use the return values to indicate errors only.

 See attached for an example.

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


More information about the tor-bugs mailing list