Skip to content

Segmentation fault (access null pointer) in ext/libxml/libxml.c #14698

Closed

Description

@YuanchengJiang

Description

The following code:

<?php
  $dom = new DOMDocument;
  $dom->loadHTML('<span title=""y">x</span><span title=""z">x</span>');
  $html = simplexml_import_dom($dom);
  foreach ($html->body->span as $obj) {
  }
  $script1_dataflow = $html;
  $array = ['foo'];
  foreach ($array as $key => &$value) {
    unset($script1_dataflow[$key]);
  }

Resulted in this output:

Segmentation fault (core dumped)

UBSan:

/php-src/ext/libxml/libxml.c:333:16: runtime error: member access within null pointer of type 'php_libxml_node_object' (aka 'struct _php_libxml_node_object')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/libxml/libxml.c:333:16

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Activity

  1. added a commit that references this issue on Jun 28, 2024
    532a260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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