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

George Joseph (JIRA) noreply at issues.asterisk.org
Thu Jun 17 07:23:33 CDT 2021


George Joseph created ASTERISK-29480:
----------------------------------------

             Summary: 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: 18.4.0, 16.18.0
            Reporter: 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.





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



More information about the asterisk-bugs mailing list