Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[RenderTreeUpdater] NULL ptr deref in updateRenderTree
https://bugs.webkit.org/show_bug.cgi?id=230581 Patch by Brandon Stewart <brandonstewart@apple.com> on 2021-09-24 Reviewed by Antti Koivisto. Source/WebCore: Text element changes are buffered. This can lead to undesirable behavior when switching a node to a document that is not rendered, and then proceeding with a rendering update. If we cannot find a renderer in a node or its ancestors then just give up instead of returning a document. Test: fast/dom/Document/clearPendingRenderTreeUpdater.html * rendering/updating/RenderTreeUpdater.cpp: (WebCore::findRenderingRoot): (WebCore::RenderTreeUpdater::commit): (WebCore::RenderTreeUpdater::createRenderer): (WebCore::RenderTreeUpdater::textRendererIsNeeded): LayoutTests: New regression test to handle case where we trigger a text update, and then switch the node to a new unrendered document. * fast/dom/Document/clearPendingRenderTreeUpdater-expected.txt: Added. * fast/dom/Document/clearPendingRenderTreeUpdater.html: Added. Canonical link: https://commits.webkit.org/242090@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283030 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
a079be7
commit 8d308cf
Showing
5 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
LayoutTests/fast/dom/Document/clearPendingRenderTreeUpdater-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This test shall pass if it does not crash. |
22 changes: 22 additions & 0 deletions
22
LayoutTests/fast/dom/Document/clearPendingRenderTreeUpdater.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<html> | ||
<body> | ||
<script> | ||
onload = () => { | ||
if (window.testRunner) | ||
testRunner.dumpAsText() | ||
|
||
let div0 = document.createElement('div'); | ||
div0.style.display = 'contents'; | ||
let div1 = document.createElement('div'); | ||
div1.append('ab'); | ||
div0.appendChild(div1); | ||
document.body.appendChild(div0); | ||
document.body.offsetTop; | ||
div1.innerHTML = 'a'; | ||
new Document().appendChild(div0); | ||
} | ||
</script> | ||
|
||
This test shall pass if it does not crash. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters