Skip to content

ext/gmp: reject values larger than unsigned long in gmp_pow/binomial/… - #21812

Closed
devnexen wants to merge 2 commits into
php:masterfrom
devnexen:gmp_internal_rewrite
Closed

ext/gmp: reject values larger than unsigned long in gmp_pow/binomial/…#21812
devnexen wants to merge 2 commits into
php:masterfrom
devnexen:gmp_internal_rewrite

Conversation

@devnexen

@devnexendevnexen commented Apr 19, 2026

Copy link
Copy Markdown
Member

…root/rootrem and shift/pow operators.

Applies the gmp_fact() pattern (0236667) to the remaining zend_long -> gmp_ulong casts that could silently overflow on LLP64 platforms.

gmp_powm() switches to zend_argument_error() with the correct argument index (3 $modulus) for modulo-by-zero.

…root/rootrem and shift/pow operators.
Applies the gmp_fact() pattern (0236667) to the remaining
zend_long -> gmp_ulong casts that could silently overflow on
LLP64 platforms.
gmp_powm() switches to zend_argument_error() with the correct
argument index ($modulus) for modulo-by-zero.
@devnexen
devnexenforce-pushed the gmp_internal_rewrite branch from 8f58a73 to 6169964CompareApril 19, 2026 07:47
Comment threadext/gmp/tests/gmp_binomial.phpt
@devnexen
devnexen marked this pull request as ready for review April 19, 2026 09:16
@devnexen
devnexen requested a review from Girgias as a code ownerApril 19, 2026 09:16

@SakiTakamachiSakiTakamachi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me :)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@devnexen@mvorisek@Girgias@SakiTakamachi