Skip to content

ExtUvLoop silently allows timers which cause integer overflow #194

Closed

Description

ExtUvLoop allows timers with an time or interval value that cause the internal conversion to cause an integer overflow to 0.

\uv_timer_start(
$event,
(int) ($interval * 1000) + 1,
0,
$callback
);

Using \PHP_INT_MAX silently causes an integer overflow to 0, and results in an intermediate firing of the timer callback.

The loop implementation should instead throw an exception if the conversion could cause an integer overflow.

Activity

  1. self-assigned this
    on May 3, 2019
  2. clue commented on May 12, 2019

    @clue
    Member

    @CharlotteDunois Thanks for spotting and reporting, this is interesting!

    On 32 bit systems this means that the maximum time interval is ~25 days (2^31 milliseconds). On 64 bit systems this is ~300 million years (2^63 milliseconds), so this is unlikely to be an issue for most common use cases.

    Is this something anybody would want to file as a PR with a simple test case?

  3. PabloKowalczyk commented on May 16, 2019

    @PabloKowalczyk
    Contributor

    @clue could I work on this issue?

  4. WyriHaximus commented on May 16, 2019

    @WyriHaximus
    Member

    @PabloKowalczyk go for it, AFAIK neither @clue or me are working on this at the moment. (It is on my/our list but not at the top.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions