Re: Overflow bug in outqueue.cpp

David Sugar <[email protected]> Thu, 15 May 2008 13:06:32 -0400
Newsgroups gmane.comp.gnu.ccrtp.devel
Message-ID <[email protected]>
I will make sure it gets fixed in the next release.  We may do one very 
soon just to cover this and other small bug fixes.

Hattori Kenta wrote:
> Hello
> 
> When I was debugging for our VoIP system, which is using ccRTP
> library, I found a bug that causes stopping to send RTP packets.
> 
> The following code to calculate 'overflow.tv_usec' field easily causes
> overflow problem.
> 
> ####
>    overflow.tv_usec = (~static_cast<uint32>(0)) % rate *
>            1000000ul / rate;
> 
> #### in OutgoingDataQueue::getSchedulingTimeout(void)
> 
> For example, when 'rate' is 8000, we first get 
> 
> 0xffffffff % 8000 = 7295
> 
> then
> 
> 7295 * 10000000 = 7295000000 > 4294967295 (overflow!!!)
> 
> This error is accumulated every time when a timestamp goes round.
> Finally it causes packet expiration and streaming will stop.
> 
> The easiest way to fix this problem might be to use unsigned long
> long as follows:
> 
>    overflow.tv_usec = (~static_cast<uint32>(0)) % rate *
>            1000000ull / rate;
>                  ^^^^^^
> 
> I originally found this problem in ccRTP-1.2.2, but it still remains
> in the newest version.
> 
> ---
> Kenta Hattori([email protected])
> Resarch Institute of Systems Planning, Inc./ISP
> 
> 
> 
> _______________________________________________
> Ccrtp-devel mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/ccrtp-devel

_______________________________________________
Ccrtp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/ccrtp-devel
dyfet.vcf (text/x-vcard, 177 B)
begin:vcard
fn:David Sugar
n:Sugar;David
org:GNU Telephony
email;internet:[email protected]
tel;work:+1 201 215 2609
url:http://www.gnutelephony.org
version:2.1
end:vcard