[asterisk-bugs] [JIRA] (ASTERISK-22081) Type cast causes incorrect schedule interval
Joshua Colp (JIRA)
noreply at issues.asterisk.org
Mon Dec 18 11:52:07 CST 2017
[ https://issues.asterisk.org/jira/browse/ASTERISK-22081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joshua Colp updated ASTERISK-22081:
-----------------------------------
Affects Version/s: 13.18.4
> 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, 13.18.4
> Environment: linux 32 and 64
> Reporter: Roman S.
> Severity: Trivial
> Attachments: sched-22081.diff
>
>
> 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 was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list