php / php-src

The PHP Interpreter
https://www.php.net
Other
38.1k stars 7.74k forks source link

zend_test.observer.observe_function_names may segfault #16414

Open YuanchengJiang opened 5 days ago

YuanchengJiang commented 5 days ago

Description

The following code:

<?php
function bar()
{}
#bar(); uncomment this will output: "/php-src/Zend/zend_observer.c:195: void zend_observer_add_begin_handler(zend_function *, zend_observer_fcall_begin_handler): Assertion `0' failed"
ini_set("zend_test.observer.observe_function_names", "bar");

Resulted in this output:

/php-src/Zend/zend_observer.c:184:53: runtime error: applying non-zero offset 18446744073709551608 to null pointer

PHP Version

nightly

Operating System

ubuntu 22.04

cmb69 commented 5 days ago

Why is

https://github.com/php/php-src/blob/79c71c9f0b5fa7e27d64075b624f92f07c64ad11/ext/zend_test/observer.c#L349

PHP_INI_ALL?

cmb69 commented 5 days ago

Ah, 9e2de4c2d95b0a391f85121d0d077c8d6d5fdcae.