Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 256843.8@webkit-2022.12-embargoed (fe2f16c). https://bugs…
….webkit.org/show_bug.cgi?id=251013 Recalculate normal flow value in RenderLayer::establishesTopLayerDidChange https://bugs.webkit.org/show_bug.cgi?id=251013 Reviewed by Tim Nguyen. In RenderLayer::rebuildZOrderLists the RenderView layer makes sure the layers for dialogs/top-level elements are appended after everything else in the positive z-order list. When removing the dialog layer, dirtyPaintOrderListsOnChildChange will be called and since it is not a normal only flow everything will be handled correctly through dirtyStackingContextZOrderLists. In the test case the behaviour is the same until dirtyPaintOrderListsOnChildChange is called on the dialog layer removal. Now that layer to be removed *is* a normal only flow (the element is no longer positioned and has non visible overflow, see RenderLayer::shouldBeNormalFlowOnly). This means the positive z-order list is unchanged and the deleted layer still part of it. When the test cleanup code does a final repaint, the RenderView positive z-order list is processed as normal and when trying to access the deleted layer the UAF happens. To fix this, make sure the normal flow value is correct when adding the layer in RenderLayer::establishesTopLayerDidChange. * LayoutTests/fast/layers/normal-flow-dialog-remove-layer-crash-expected.html: Added. * LayoutTests/fast/layers/normal-flow-dialog-remove-layer-crash.html: Added. * Source/WebCore/rendering/RenderLayer.cpp: (WebCore::RenderLayer::establishesTopLayerDidChange): Canonical link: https://commits.webkit.org/256843.8@webkit-2022.12-embargoed
- Loading branch information