Overflow in pj_math_stat_update

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

 



On Tue, Jul 22, 2008 at 12:41 PM, Ravi Inder Singh <raviinder at gmail.com>
wrote:

> Hi all,
>  Inside fuction pj_math_stat_update,calling from pjmedia_rtcp_xr_rx_rtp is
> leading to overflow in mean calculation, as jitter value is less than mean
> value & delta comes out to be in minus value.
>
>    delta = val - stat->mean; {leads to minus value, coz while setting we
> make it divide by 16 in this code
>
> #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
>         pjmedia_rtcp_xr_rx_rtp(&sess->xr_session, seq,
>                    0,                /* lost    */
>                    0,                /* dup     */
>                    discarded,            /* discard */
>                    (sess->jitter >> 4),        /* jitter  */
>                    -1, 0);            /* toh     */
> #endif
>
> }
> This all leads to some overflow value in int variable, leading wrong
> results.
>

Minus value in delta variable is perfectly fine, and unless you give
negative "val" value, the "fmean_" and "mean" variable will never have
negative value.

Do you have sample data to prove your observation?

Cheers
 Benny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080722/ec5dda5a/attachment.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux