Repository navigation
Conversation
- Integer division or modulo by zero, and INT64_MIN / -1, raised SIGFPE; raise an FFI\ParserException instead. - '\a' was never assigned, and the hex digits A-F/a-f in '\xNN' were converted to 0-5. - sizeof of a character constant is sizeof(int), as in C. - _Alignas(N) used the alignment of the constant's type instead of N. - An unsigned value compared with a character constant read the uninitialized double member of the operand.
A CType obtained from a temporary FFI instance points into the instance's symbol table, which is freed with it (ASan: heap-use-after-free in FFI::alignof).
|
Thanks!
|
The operands of % must have integer type. A floating operand was converted to an integer before the remainder, so 1.0 % 0 or 1 % 0.0 raised SIGFPE.
|
ndossche
left a comment
There was a problem hiding this comment.
This looks mostly right but I'm concerned about a few backwards incompatible changes going into a near-EOL bugfix branch:
- Alignas changes, if a user worked around the bugs then their code suddenly breaks in a patch release
- Modulo operator now throws a parser exception
- sizeof(character) increases from 1 to 4
There's also still some bugs/inconsistencies:
- alignof('a') still returns 1
- This crashes:
typedef char A[((-9223372036854775807 - 1) / '\xff') ? 1 : 2];
Keep only the SIGFPE fixes on PHP-8.4: reject an integer division or remainder by zero, and INT64_MIN / -1, after the operand conversions that zend_ffi_expr_math() and zend_ffi_expr_int_math() perform, so a character divisor such as '\377' and floating operands of % are covered. The changes to constant values (_Alignas, sizeof of a character constant, escape sequences, character comparisons) move to master.
|
Fixes the crashes from #25573 (the constant value fixes are in #25724 against master).