Skip to content

Fix GH-25305: NULL dereference in lxb_dom_document_destroy on lexbor … - #25320

Closed
devnexen wants to merge 1 commit into
php:PHP-8.5from
devnexen:gh25305
Closed

devnexen wants to merge 1 commit into
php:PHP-8.5from
devnexen:gh25305

Conversation

@devnexen

@devnexen devnexen commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

…document init failure

lxb_dom_document_init() set owner_document only after all of the document's memory pools were created. When one of these allocations failed, which the fallible lexbor allocators make possible once memory_limit is reached, the error path of
lxb_html_document_interface_create() called lxb_dom_document_destroy() with a NULL owner_document and dereferenced it. The failure path also left dangling pointers to the destroyed pools.

Set owner_document before allocating and reset the pool pointers on failure, carried as a lexbor patch until lexbor/lexbor#448 is merged. Only the source/lexbor part of the upstream change is carried.

…or document init failure

lxb_dom_document_init() set owner_document only after all of the
document's memory pools were created. When one of these allocations
failed, which the fallible lexbor allocators make possible once
memory_limit is reached, the error path of
lxb_html_document_interface_create() called lxb_dom_document_destroy()
with a NULL owner_document and dereferenced it.

lexbor/lexbor@e651d6b

Only the source/lexbor part of the upstream change is carried.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants