Skip to content

member access within misaligned address zend_iterators.c:91 #16165

@chongwick

Description

@chongwick

Description

The following code:

<?php
ob_clean();
$hugetempl = array('length' => PHP_INT_MAX);
$huge = array();
for ($i = 0; $i < $hugetempl['length']; $i++) {
    $huge[] = new DOMDocument;
    $huge[$i]->loadXML('<foo>foo'. $i. '</foo>');
    $nodes = $huge[$i]->documentElement->childNodes;
    $iter = $nodes->getIterator();
    file_get_contents("/proc/self/maps") ^ PHP_INT_MAX;
    clone $iter;
    $stat = stat('/dev/urandom');
    $stat[0] = PHP_INT_MAX;
    while (true) {
        echo str_repeat('a', PHP_INT_MAX);
    }
}
?>

Resulted in this output:

/home/dan/php-8.3.9/Zend/zend_iterators.c:91:6: runtime error: member access within misaligned address 0x000000000009 for type 'struct zend_object_iterator', which requires 8 byte alignment

But I expected this output instead:

PHP Version

8.3.9

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