Title: [288063] trunk/Tools
Revision
288063
Author
[email protected]
Date
2022-01-15 12:32:22 -0800 (Sat, 15 Jan 2022)

Log Message

Bug 234910 - jsc_fuz/wktr: crash with exotic settings
https://bugs.webkit.org/show_bug.cgi?id=234910

Patch by Frédéric Wang <[email protected]> on 2022-01-15
Reviewed by Michael Saboff.

ASAN release build of WebKitTestRunner and DumpRenderTree may crash when loading the file
with content "<script>'a'+Math.floor()+'a';</script>" when the ASAN option
detect_stack_use_after_return=1 is set and when the JSC option slowPathAllocsBetweenGCs takes
to specific values. This is because the 'TestRendered' string of WTR::sendTestRenderedEvent
can be garbage collected. This patch fixes that issue by protecting that string. The fix has
been verified for all slowPathAllocsBetweenGCs values from 1 to 100.

* TestRunnerShared/ReftestFunctions.cpp:
(WTR::sendTestRenderedEvent): Protect "TestRendered" JSString from garbage collection until
the event is dispatched.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (288062 => 288063)


--- trunk/Tools/ChangeLog	2022-01-15 20:24:11 UTC (rev 288062)
+++ trunk/Tools/ChangeLog	2022-01-15 20:32:22 UTC (rev 288063)
@@ -1,3 +1,21 @@
+2022-01-15  Frédéric Wang  <[email protected]>
+
+        Bug 234910 - jsc_fuz/wktr: crash with exotic settings
+        https://bugs.webkit.org/show_bug.cgi?id=234910
+
+        Reviewed by Michael Saboff.
+
+        ASAN release build of WebKitTestRunner and DumpRenderTree may crash when loading the file
+        with content "<script>'a'+Math.floor()+'a';</script>" when the ASAN option
+        detect_stack_use_after_return=1 is set and when the JSC option slowPathAllocsBetweenGCs takes
+        to specific values. This is because the 'TestRendered' string of WTR::sendTestRenderedEvent
+        can be garbage collected. This patch fixes that issue by protecting that string. The fix has
+        been verified for all slowPathAllocsBetweenGCs values from 1 to 100.
+
+        * TestRunnerShared/ReftestFunctions.cpp:
+        (WTR::sendTestRenderedEvent): Protect "TestRendered" JSString from garbage collection until
+        the event is dispatched.
+
 2022-01-15  Tyler Wilcock  <[email protected]>
 
         AX: Fix disabled-controls-not-focusable.html in isolated tree mode by updating AXPropertyName::CanSetFocusAttribute when the disabled attribute changes

Modified: trunk/Tools/TestRunnerShared/ReftestFunctions.cpp (288062 => 288063)


--- trunk/Tools/TestRunnerShared/ReftestFunctions.cpp	2022-01-15 20:24:11 UTC (rev 288062)
+++ trunk/Tools/TestRunnerShared/ReftestFunctions.cpp	2022-01-15 20:32:22 UTC (rev 288063)
@@ -36,9 +36,12 @@
         return;
     auto initializer = JSObjectMake(context, nullptr, nullptr);
     setProperty(context, initializer, "bubbles", true);
-    auto event = callConstructor(context, "Event", { makeValue(context, "TestRendered"), initializer });
+    auto value = makeValue(context, "TestRendered");
+    JSValueProtect(context, value);
+    auto event = callConstructor(context, "Event", { value, initializer });
     auto documentElement = objectProperty(context, JSContextGetGlobalObject(context), { "document", "documentElement" });
     call(context, documentElement, "dispatchEvent", { event });
+    JSValueUnprotect(context, value);
 }
 
 bool hasReftestWaitAttribute(JSGlobalContextRef context)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to