Skip to content

SEGV Zend/zend_stack.c #17429

@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
function output_html($ext) {
}
class MySessionHandler implements SessionHandlerInterface {
function open ($save_path, $session_name): bool {
return true;
}
function close(): bool {
}
function read ($id): string {
return '';
}
function write ($id, $sess_data): bool {
ob_start("output_html");
}
function destroy ($id): bool {
}
function gc ($maxlifetime): int {
}
}
session_set_save_handler(new MySessionHandler());
session_start();
ob_start(function() {
for ($i = count($a); $i > 0; --$i) {
}
});
while (1) {
$a[] = 1;
}

Resulted in this output:

Fatal error: {closure:/tmp/test.php:23}(): Cannot use output buffering in output buffering display handlers in /tmp/test.php on line 24
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_stack.c:40:9: runtime error: applying zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_stack.c:40:9 in

PHP Version

nightly

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions