[asterisk-bugs] [JIRA] (ASTERISK-22081) Type cast causes incorrect schedule interval

Rusty Newton (JIRA) noreply at issues.asterisk.org
Tue Aug 6 17:57:03 CDT 2013


     [ https://issues.asterisk.org/jira/browse/ASTERISK-22081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rusty Newton updated ASTERISK-22081:
------------------------------------

    Assignee: Matt Jordan  (was: Roman S.)
      Status: Triage  (was: Waiting for Feedback)
    
> Type cast causes incorrect schedule interval
> --------------------------------------------
>
>                 Key: ASTERISK-22081
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-22081
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: General
>    Affects Versions: 1.8.23.0, 10.12.2, 11.5.0
>         Environment: linux 32 and 64
>            Reporter: Roman S.
>            Assignee: Matt Jordan
>            Severity: Trivial
>
> If there is a single event with {{when}} in the distant future then function {{ast_sched_wait}} returns zero value (no wait - run it now). This causes high CPU utilization.
> This happens when {{ast_tvdiff_ms}} returns value of type {{int64_t}} which is greater then INT_MAX ({{ms}} of type {{int}}) - negative {{int}} value occurs).
> {noformat}
> int ast_sched_wait(struct ast_sched_context *con)
> {
>         int ms;
> ...
>                 ms = ast_tvdiff_ms(s->when, ast_tvnow());
> {noformat}
> {noformat}
> int64_t ast_tvdiff_ms(struct timeval end, struct timeval start),
> {noformat}
> For 32bit OS it's 24 days schedule interval - big enough, but still possible.
> I suppose that type change and additional check is required:
> {noformat}
>         int64_t ms;
> ...
>                 if (ms > INT_MAX) {
>                         ms = -1;
>                 else if (ms < 0) {
> ...
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list