[php-src] PR #25575: Fix GH-25573: FFI constant expression evaluation
| From: | Marti2203 | Date: | Thu, 19 Nov 2026 05:21:50 +0000 |
| Subject: | [php-src] PR #25575: Fix GH-25573: FFI constant expression evaluation | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40796@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25575
Author: Marti2203
Fixes #25573.
> -
zend_ffi_expr_div() /
> zend_ffi_expr_mod(): integer division or modulo by zero, and
> INT64_MIN / -1, raise an
> FFI\ParserException ("Division by zero or overflow in constant
> expression") instead of SIGFPE.
> - zend_ffi_val_character(): assign
> '\a', and convert the hex digits A-F/a-f to 10-15 (they
> gave 0-5).
> - zend_ffi_expr_sizeof_val():
> sizeof of a character constant is
> sizeof(int).
> - zend_ffi_align_as_val():
> _Alignas(N) uses N. _Alignas(0) has
> no effect; a value that is not a power of two is rejected.
> - zend_ffi_expr_cmp: an unsigned value compared with a
> character constant now uses op2->ch; it read the uninitialized
> op2->d.
>
> The mixed signed/unsigned comparison semantics described in the issue
> (0xFFFFFFFFu == -1, -1 < 1u) are
> not changed here.
>
> ext/ffi/tests/gh25573.phpt covers each case; it fails without
> the change (SIGFPE). ext/ffi/tests pass.
>
> This issue was found by an LLM-assisted tool and verified manually.