[php-src] Issue #15481: Member access within misaligned address in ext/opcache/jit/zend_jit_vm_helpers.c

From: Date: Sun, 18 Aug 2024 11:15:21 +0000
Subject: [php-src] Issue #15481: Member access within misaligned address in ext/opcache/jit/zend_jit_vm_helpers.c
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247523@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15481 Author: YuanchengJiang ### Description The following code: ```php <?php $xw = new XMLWriter(); $xw->openMemory(); $xw->setIndent(TRUE); $xw->startDocument(NULL, "UTF-8"); $xw->writeDtdElement('sxe', '(elem1+, elem11, elem22*)'); $xw->writeDtdAttlist('sxe', 'id CDATA #implied'); $xw->startDtdElement('elem1'); $xw->text('elem2*'); $xw->endDtdElement(); $xw->startDtdAttlist('elem1'); $xw->text("attr1 CDATA #required\n"); $xw->text('attr2 CDATA #implied'); $xw->endDtdAttlist(); $xw->endDocument(); // Force to write and empty the buffer $output = $xw->flush(true); print $output; $v1 = $xw; var_dump(Loader::getCounter()); ``` Resulted in this output: ``` /php-src/ext/opcache/jit/zend_jit_vm_helpers.c:252:17: runtime error: member access within misaligned address 0x940f00f9834807e1 for type 'struct zend_jit_op_array_hot_extension', which requires 8 byte alignment 0x940f00f9834807e1: note: pointer points here <memory cannot be printed> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/opcache/jit/zend_jit_vm_helpers.c:252:17 in ``` To reproduce: ``` php -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=1235" ./test.php ``` ### PHP Version PHP 8.4.0-dev ### Operating System ubuntu 22.04

« previous php.bugs (#247523) next »