[php-src] Issue #15181: Unexpected null pointer in Zend/zend_string.h

From: Date: Wed, 31 Jul 2024 13:25:11 +0000
Subject: [php-src] Issue #15181: Unexpected null pointer in Zend/zend_string.h
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247407@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15181 Author: YuanchengJiang ### Description The following code: ```php <?php function test($vars) { foreach ($vars as $i => $v1) { foreach ($vars as $j => $v2) { try { $randomFunction = 'ob_flush'; $reflection = new ReflectionFunction($randomFunction); $args = []; $result[$randomFunction][] = $reflection->invokeArgs($args); } catch (\Throwable $e) { } } } } function var_fusion($var1, $var2, $var3) { $vars = [$var1, $var2, $var3]; try{ test($vars); } catch (ReflectionException $e) { } } ob_start(function () { throw new \Exception('ob_start'); }); var_fusion($x, $y, $z); ``` Resulted in this output: ``` /php-src/Zend/zend_string.h:200:24: runtime error: null pointer passed as argument 2, which is declared to never be null /usr/include/string.h:44:28: note: nonnull attribute specified here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/Zend/zend_string.h:200:24 ``` ### PHP Version PHP 8.4.0-dev ### Operating System ubuntu 22.04

« previous php.bugs (#247407) next »