[php-src] PR #13846: Fix GH-13834: Applying non-zero offset 36 to null pointer in zend_jit.c
| From: | nielsdos | Date: | Sat, 30 Mar 2024 23:47:41 +0000 |
| Subject: | [php-src] PR #13846: Fix GH-13834: Applying non-zero offset 36 to null pointer in zend_jit.c | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25584@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13846
Author: nielsdos
ssa_op can be NULL in function JIT. Doing pointer arithmetic on a NULL pointer is undefined
behaviour. Undefined behaviour can be dangerous because the optimizer may assume then that the
variable is not actually NULL.
To solve this:
1. Add ADVANCE_SSA_OP() to safely add an offset to ssa_op in zend_jit.c
2. For inference, add an extra offset argument to the helper functions.
3. Replace open-coded
_ssa_op1_info with helper macros because we would have to change
those lines anyway for the extra argument.
To reproduce this, use Clang (not GCC) on a test like sapi/cli/tests/gh12363.phpt (or other tests
also work).
Targeting master, if no problems we can backport.