[asterisk-bugs] [Asterisk 0011348]: RTP session ID is negative half the time on x86_64

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Nov 22 15:11:43 CST 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=11348 
====================================================================== 
Reported By:                sperreault
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   11348
Category:                   Channels/chan_sip/General
Reproducibility:            random
Severity:                   major
Priority:                   normal
Status:                     new
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 89526 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             11-22-2007 08:19 CST
Last Modified:              11-22-2007 15:11 CST
====================================================================== 
Summary:                    RTP session ID is negative half the time on x86_64
Description: 
I'm surprised this hasn't been reported before (which makes me doubt my
findings).

ast_random() returns a positive long. When this gets truncated to an int,
it is no longer guaranteed positive. It will be negative exactly half the
time. This may make clients very unhappy. Eyebeam, for example, drops the
connection when it sees a negative session ID.
====================================================================== 

---------------------------------------------------------------------- 
 dimas - 11-22-07 15:11  
---------------------------------------------------------------------- 
Hm... According to the random manpage, it returns "numbers in the range
from 0 to RAND_MAX" that is positive. Since ast_random falls back to random
in the case /dev/urandom is missing, isn't it a good idea just to fix
ast_random so it will be alays returning positive values? 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
11-22-07 15:11  dimas          Note Added: 0074215                          
======================================================================




More information about the asterisk-bugs mailing list