[php-src] Issue #23796: Potential NULL dereference in sccp.c

From: Date: Sun, 20 Sep 2026 16:10:54 +0000
Subject: [php-src] Issue #23796: Potential NULL dereference in sccp.c
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252785@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/23796 Author: Ti-Mis ### Description Potential problem Hi! I was analyzing the source code and came across a potential issue in [Zend/Optimizer/sccp.c](https://github.com/php/php-src/blob/6b2b60f683afbdb649862273c8de570e963c1b17/Zend/Optimizer/sccp.c#L1340). In the following line: if (ct_eval_fetch_obj(&tmp, op1, op2) == SUCCESS) { op2 is obtained using get_op2_value(). If opline->op2_type != IS_CONST and ssa_op->op2_use == -1, this function may return NULL. At the same time, the SKIP_IF_TOP(op2) macro appears to check for the IS_TOP(op2) state, but does not explicitly check whether op2 is NULL. As a result, it seems possible that ct_eval_fetch_obj() could be called with op2 == NULL. Inside ct_eval_fetch_obj(), op2 is passed to fetch_obj_prop(), where it appears to be dereferenced without a prior NULL check. Could you please check whether it is guaranteed that op2 is always non-NULL at this point? I would appreciate it if you could verify this scenario. Found with SVACE ### PHP Version ```plain PHP 8.3.24 ``` ### Operating System Ubuntu 24.04

« previous php.bugs (#252785) next »