Skip to content

Fix Range::extractContents() out-of-bounds extraction bug#58132

Merged
chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-55f4ab521e
Feb 28, 2026
Merged

Fix Range::extractContents() out-of-bounds extraction bug#58132
chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-55f4ab521e

Conversation

@chromium-wpt-export-bot

Copy link
Copy Markdown
Collaborator

When Range::extractContents() processes nodes, it may fire synchronous
events (such as iframe 'unload'). If an event listener removes the
Range's end container from the DOM, the extraction process could lose
its end boundary. In this case, it would previously continue extracting
elements out-of-bounds up to the end of the common root container.

This CL fixes the issue by validating that the original end container is
still a descendant of the common root. If it has been disconnected, the
extraction loop aborts early.

See also:
whatwg/dom#1446

Fixed: 486423704
Change-Id: Ife2173713df70dd77f6fd29c593aa5f72d88ab24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7615530
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1591852}

When Range::extractContents() processes nodes, it may fire synchronous
events (such as iframe 'unload'). If an event listener removes the
Range's end container from the DOM, the extraction process could lose
its end boundary. In this case, it would previously continue extracting
elements out-of-bounds up to the end of the common root container.

This CL fixes the issue by validating that the original end container is
still a descendant of the common root. If it has been disconnected, the
extraction loop aborts early.

See also:
whatwg/dom#1446

Fixed: 486423704
Change-Id: Ife2173713df70dd77f6fd29c593aa5f72d88ab24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7615530
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1591852}

@wpt-pr-bot wpt-pr-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 7287b46 into master Feb 28, 2026
24 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-55f4ab521e branch February 28, 2026 00:21
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.

3 participants