[asterisk-bugs] [JIRA] (ASTERISK-29480) fixedjitterbuffer contains an un-wrappered assert that triggers on a negative time slew

Friendly Automation (JIRA) noreply at issues.asterisk.org
Thu Jun 24 08:21:33 CDT 2021


    [ https://issues.asterisk.org/jira/browse/ASTERISK-29480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=255454#comment-255454 ] 

Friendly Automation commented on ASTERISK-29480:
------------------------------------------------

Change 16073 merged by Friendly Automation:
jitterbuffer:  Correct signed/unsigned mismatch causing assert

[https://gerrit.asterisk.org/c/asterisk/+/16073|https://gerrit.asterisk.org/c/asterisk/+/16073]

> fixedjitterbuffer contains an un-wrappered assert that triggers on a negative time slew
> ---------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-29480
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29480
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Jitterbuffer
>    Affects Versions: 16.18.0, 18.4.0
>            Reporter: Dan Cropp
>            Assignee: George Joseph
>
> If the system time slews backwards because of a time adjustment between the time a frame is timestamped and the time we check the timestamps in abstract_jb:hook_event_cb(), we get a negative interval, but we don't check for that there.   abstract_jb:hook_event_cb() then calls fixedjitterbuffer:fixed_jb_get() (via  abstract_jb:jb_get_fixed) and the first thing that does is assert(interval >= 0).   
> There are several issues with this...
>  * abstract_jb:hook_event_cb() saves the interval in a variable named "now" which is confusing in itself. :)
>  * "now" is defined as an unsigned int which converts the negative value returned from ast_tvdiff_ms() to a large positive value.
> * fixed_jb_get()'s parameter is defined as a signed int so the interval gets converted back to a negative value.
> * fixed_jb_get()'s assert is NOT an ast_assert but a direct define that points to the system assert() so it triggers even in production mode.
> We should...
>  * Redefine hook_event_cb()'s "now" variable as an int64_t which matches the return from ast_tvdiff_ms().
>  * Check for negative difference right after the call to ast_tvdiff_ms() and just pass the frame through if it is.
>  * Fix any asserts in fixedjitterbuffer to call the ast_assert wrapper.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list