Skip to content

Memory Leak in DOM -> insertBefore #16534

Closed as not planned
Closed as not planned
@chibinz

Description

@chibinz

Description

The following code:

<?php
$v0 = new DOMAttr ( "i" );
$v8 = new DOMDocument ( );

$v8 -> insertBefore ( $v0 );

Resulted in this output:


Fatal error: Uncaught Error: Cannot add newnode as the previous sibling of refnode in /workspaces/TriFuzz/triaged/dom_leak2.php:5
Stack trace:
#0 /workspaces/TriFuzz/triaged/dom_leak2.php(5): DOMNode->insertBefore(Object(DOMAttr))
#1 {main}
  thrown in /workspaces/TriFuzz/triaged/dom_leak2.php on line 5

=================================================================
==1231==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x5650eda879ae in malloc /opt/llvm-15-build/llvm-15.x/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
    #1 0x7faa3c34bdad in xmlNewProp (/lib/x86_64-linux-gnu/libxml2.so.2+0x62dad) (BuildId: aebf8e42966c3ce475ff9d9d51a762831adcbb61)

Indirect leak of 2 byte(s) in 1 object(s) allocated from:
    #0 0x5650eda879ae in malloc /opt/llvm-15-build/llvm-15.x/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
    #1 0x7faa3c3cc7f2 in xmlStrdup (/lib/x86_64-linux-gnu/libxml2.so.2+0xe37f2) (BuildId: aebf8e42966c3ce475ff9d9d51a762831adcbb61)

SUMMARY: AddressSanitizer: 98 byte(s) leaked in 2 allocation(s).

PHP Version

PHP 8.5.0-dev

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