[php-src] Issue #16009: Segmentation fault in main/spprintf.c
| From: | YuanchengJiang | Date: | Mon, 23 Sep 2024 13:32:21 +0000 |
| Subject: | [php-src] Issue #16009: Segmentation fault in main/spprintf.c | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247866@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/16009
Author: YuanchengJiang
### Description
The following code:
```php
<?php
$dom = DOM\XMLDocument::createFromString(<<<XML
<html xmlns="http://www.w3.org/1999/xhtml">
<input type="text" placeholder="" />
<textarea placeholder="" />
<input xmlns="" type="text" placeholder="" />
<textarea xmlns="" placeholder="" />
<input type="text" />
<textarea />
</html>
XML);
$fusion = $dom;
function testMin2First(int $value): int {
$value = min($value, 100);
return $value;
}
function testMin2Second(int $fusion): int {
$value = min(100, $value);
return $value;
}
function testMin2_TMP(int $value): int {
$value = min($value + 1, 100);
return $value;
}
var_dump(testMin2First(5));
var_dump(testMin2Second(5));
?>
```
Resulted in this output:
```
/php-src/main/spprintf.c:376:14: runtime error: member access within misaligned address
0x200238000000002 for type 'zend_string' (aka 'struct _zend_string'), which
requires 8 byte alignment
```
To reproduce:
```
-d "extension_dir=/php-src/modules/" -d
"zend_extension=/php-src/modules/opcache.so" -d "opcache.enable=1" -d
"opcache.enable_cli=1" -d "opcache.jit=1012"
```
### PHP Version
PHP 8.4.0-dev
### Operating System
ubuntu 22.04