[GIT-PULLS] [php-src] PR #23449: JIT: Fix zend_jit_trace_find_init_fcall_op()

[email protected] (arnaud-lb)
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/23449
Author: arnaud-lb

`zend_jit_trace_find_init_fcall_op()` tries to find the `INIT_FCALL` opline corresponding to a `ZEND_JIT_TRACE_INIT_CALL` record, but it fails to do so in the `ZEND_JIT_TRACE_FAKE_INIT_CALL` case, for nested calls.

The `ZEND_JIT_TRACE_FAKE_INIT_CALL` case implies that `p` points to a sequence of `ZEND_JIT_TRACE_INIT_CALL` trace records. The first loop in `zend_jit_trace_find_init_fcall_op()` is supposed to find the first `opline` after the sequence of `ZEND_JIT_TRACE_INIT_CALL` record, but it mistakenly decrements `p` after initially incrementing it. As a result `p` eventually points to an invalid record.

It works for non-nested calls because the `p->op == ZEND_JIT_TRACE_VM` condition is true on the first iteration in that case.

This can not lead to a crash or miscompilations, but this results in lost optimization opportunities.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.