mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibWeb: Empty CE reaction queue instead of destroying it on exception
If an exception occurs in a custom element constructor, we clear the reaction queue by destroying it, instead of emptying the Vector.3da6916383/Userland/Libraries/LibWeb/DOM/Element.cpp (L2033)This causes a UAF here, as async upgrades (i.e. custom elements not created by document.createElement) are performed in this loop:3da6916383/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp (L657)Fixes crash when loading https://github.com/SerenityOS/serenity
This commit is contained in:
@@ -2030,7 +2030,8 @@ JS::ThrowCompletionOr<void> Element::upgrade_element(JS::NonnullGCPtr<HTML::Cust
|
||||
m_custom_element_definition = nullptr;
|
||||
|
||||
// 2. Empty element's custom element reaction queue.
|
||||
m_custom_element_reaction_queue = nullptr;
|
||||
if (m_custom_element_reaction_queue)
|
||||
m_custom_element_reaction_queue->clear();
|
||||
|
||||
// 3. Rethrow the exception (thus terminating this algorithm).
|
||||
return maybe_exception.release_error();
|
||||
|
||||
Reference in New Issue
Block a user