Skip to content

UAF in lexer with encoding translation and heredocs #16630

@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
$data3 = <<<DATA
<meta <meta name="keywords" content="php documentation">
$data4 = <<<DATA
<meta name="author" content="name"
<meta name="keywords" content="php documentation"
DATA;
foreach ($array as $html) {
}

Resulted in this output:

php: /home/phpfuzz/WorkSpace/diffphp/php-src/Zend/zend_execute.c:4341: void i_init_code_execute_data(zend_execute_data *, zend_op_array *, zval *): Assertion `op_array->fn_flags & (1 << 26)' failed.

And JIT 1231:

/Zend/Optimizer/zend_optimizer.c:1187: void zend_revert_pass_two(zend_op_array *): Assertion `(op_array->fn_flags & (1 << 25)) != 0' failed.
Aborted (core dumped)

It can cause segfault:

<?php
$data3 = <<<CODE
<meta <meta name="keywords" content="php documentation">
<meta name="author" content="name"
<meta name="keywords" content="php documentation"
CODE;
foreach ($array as $html) {
}

while it does not segfault in JIT

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions