ccrtp-devel
[Top][All Lists]
Advanced

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

[Ccrtp-devel] Bugreport: missing bracket in NTP2Timeval(...)


From: Martin Runge
Subject: [Ccrtp-devel] Bugreport: missing bracket in NTP2Timeval(...)
Date: Sun, 28 Oct 2007 19:02:31 +0100
User-agent: KMail/1.9.7

Hi all,

I found a bug in ccrtp-1.5.1 in the function:
 
timeval NTP2Timeval(uint32 msw, uint32 lsw)


--- ccrtp-1.5.1/src/rtcppkt.orig.cpp    2006-12-31 14:12:40.000000000 +0100
+++ ccrtp-1.5.1/src/rtcppkt.cpp 2007-10-28 18:54:49.000000000 +0100
@@ -61,7 +61,7 @@
 {
        struct timeval t;
        t.tv_sec = msw - NTP_EPOCH_OFFSET;
-       t.tv_usec = (uint32)(((double)lsw) * 1000000.0) / ((uint32)(~0));
+       t.tv_usec = (uint32)((((double)lsw) * 1000000.0) / ((uint32)(~0)));
        return t;
 }


A pair of brackets is missing. ((double)(lsw) * 1000000.0) is casted to 
uint32_t before dividing it by ((uint32)(~0)) instead of dividing it first 
and casting the result.
Microseconds in the struct timval are always 0 because of this.

regards
Martin Runge




reply via email to

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