Skip to content

Random extension random.c:95:20: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int' #9083

Closed

Description

@Girgias

Description

Various SPL tests on master now fail with:

random.c:95:20: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'

PHP Version

master

Operating System

Fedora 35

Activity

  1. cmb69 commented on Jul 21, 2022

    @cmb69
    Member

    ext/spl/php_spl.c includes ext/random/php_random.h:

    #include "ext/random/php_random.h"

    However, that is apparently not needed for that compilation unit.

  2. guilliamxavier commented on Jul 21, 2022

    @guilliamxavier
    Contributor

    @cmb69 indeed, this line (previously

    #include "ext/standard/php_mt_rand.h"
    ) could have been removed in fd8770e (maybe should be now)

    But besides that, there's indeed an UB to "fix": #9056 (comment)

  3. Girgias commented on Jul 21, 2022

    @Girgias
    MemberAuthor

    ext/spl/php_spl.c includes ext/random/php_random.h:

    #include "ext/random/php_random.h"

    However, that is apparently not needed for that compilation unit.

    Removing it doesn't seem to fix the issue in SPL anyway

  4. guilliamxavier commented on Jul 21, 2022

    @guilliamxavier
    Contributor

    Sorry for the noise:

    #include "ext/random/php_random.h"
    (previously
    #include "ext/standard/php_rand.h"
    ) seems unneeded too (but there I don't even see why it was added in the first place)

    Anyway, removing it won't fix the issue either 😅

  5. cmb69 commented on Jul 21, 2022

    @cmb69
    Member

    Removing it doesn't seem to fix the issue in SPL anyway

    Nope, but #9056 (comment) should.

  6. added a commit that references this issue on Jul 21, 2022
  7. added a commit that references this issue on Jul 22, 2022
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