ccrtp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ccrtp-devel] Overflow bug in outqueue.cpp


From: Hattori Kenta
Subject: [Ccrtp-devel] Overflow bug in outqueue.cpp
Date: Thu, 15 May 2008 11:46:39 +0900
User-agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.7 (Sanjō) APEL/10.6 Emacs/21.3 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI)

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(address@hidden)
Resarch Institute of Systems Planning, Inc./ISP





reply via email to

[Prev in Thread] Current Thread [Next in Thread]