Skip to content

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

Closed
devnexen wants to merge 2 commits intophp: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 intophp:masterfrom
devnexen:gmp_internal_rewrite

Conversation

@devnexen
Copy link
Copy Markdown
Member

@devnexen devnexen commented Apr 19, 2026

…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 devnexen force-pushed the gmp_internal_rewrite branch from 8f58a73 to 6169964 Compare April 19, 2026 07:47
Comment thread ext/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 owner April 19, 2026 09:16
Copy link
Copy Markdown
Member

@SakiTakamachi SakiTakamachi left a comment

Choose a reason for hiding this comment

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

looks good to me :)

@devnexen devnexen closed this in 617e4c3 Apr 20, 2026
Sign up for free to 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