php / php-src

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

Segmentation fault (access null pointer) in Zend/zend_API.h:84 #16359

Closed YuanchengJiang closed 1 week ago

YuanchengJiang commented 1 week ago

Description

The following code:

<?php
$log_file = tempnam(sys_get_temp_dir(), 'php-curl-CURLOPT_WRITEFUNCTION-trampoline');
$fp = fopen($log_file, 'w+');
fwrite($fp, "test");
$ch = curl_init();
curl_setopt($ch, CURLOPT_WRITEFUNCTION, $fusion);
curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
curl_exec($ch);

Resulted in this output:

/php-src/Zend/zend_API.h:847:6: runtime error: member access within null pointer of type 'zend_function' (aka 'union _zend_function')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/Zend/zend_API.h:847:6

PHP Version

nightly

Operating System

ubuntu 22.04

devnexen commented 1 week ago

Occurs only since 8.4 with the conversion to FCC interface for function user.