Title: [287354] trunk
- Revision
- 287354
- Author
- [email protected]
- Date
- 2021-12-22 04:31:35 -0800 (Wed, 22 Dec 2021)
Log Message
null ptr deref in DocumentTimeline::animate
https://bugs.webkit.org/show_bug.cgi?id=234260
Patch by Frédéric Wang <[email protected]> on 2021-12-22
Reviewed by Darin Adler.
Source/WebCore:
Test: webanimations/document-timeline-animate-crash.html
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::animate): If the WeakPtr m_document was destroyed, throw a
TypeError exception so that the call to WebAnimation::create won't cause a null ptr deref.
LayoutTests:
Add non-regression test.
* webanimations/document-timeline-animate-crash-expected.txt: Added.
* webanimations/document-timeline-animate-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (287353 => 287354)
--- trunk/LayoutTests/ChangeLog 2021-12-22 10:13:07 UTC (rev 287353)
+++ trunk/LayoutTests/ChangeLog 2021-12-22 12:31:35 UTC (rev 287354)
@@ -1,3 +1,15 @@
+2021-12-22 Frédéric Wang <[email protected]>
+
+ null ptr deref in DocumentTimeline::animate
+ https://bugs.webkit.org/show_bug.cgi?id=234260
+
+ Reviewed by Darin Adler.
+
+ Add non-regression test.
+
+ * webanimations/document-timeline-animate-crash-expected.txt: Added.
+ * webanimations/document-timeline-animate-crash.html: Added.
+
2021-12-22 Youenn Fablet <[email protected]>
Use requester when calling updateRequestAndAddExtraFields
Added: trunk/LayoutTests/webanimations/document-timeline-animate-crash-expected.txt (0 => 287354)
--- trunk/LayoutTests/webanimations/document-timeline-animate-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/webanimations/document-timeline-animate-crash-expected.txt 2021-12-22 12:31:35 UTC (rev 287354)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: This test PASS if it does not CRASH.
+
Added: trunk/LayoutTests/webanimations/document-timeline-animate-crash.html (0 => 287354)
--- trunk/LayoutTests/webanimations/document-timeline-animate-crash.html (rev 0)
+++ trunk/LayoutTests/webanimations/document-timeline-animate-crash.html 2021-12-22 12:31:35 UTC (rev 287354)
@@ -0,0 +1,16 @@
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+ console.log('This test PASS if it does not CRASH.')
+ _onload_ = async () => {
+ for (let i = 0; i < 100; i++) {
+ let documentTimeline = new DocumentTimeline();
+ await caches.has('a');
+ try {
+ documentTimeline.animate(() => {});
+ } catch(e) {
+ // Catch flaky exception, so that it does not show up in dumped text.
+ }
+ }
+ };
+</script>
Modified: trunk/Source/WebCore/ChangeLog (287353 => 287354)
--- trunk/Source/WebCore/ChangeLog 2021-12-22 10:13:07 UTC (rev 287353)
+++ trunk/Source/WebCore/ChangeLog 2021-12-22 12:31:35 UTC (rev 287354)
@@ -1,3 +1,16 @@
+2021-12-22 Frédéric Wang <[email protected]>
+
+ null ptr deref in DocumentTimeline::animate
+ https://bugs.webkit.org/show_bug.cgi?id=234260
+
+ Reviewed by Darin Adler.
+
+ Test: webanimations/document-timeline-animate-crash.html
+
+ * animation/DocumentTimeline.cpp:
+ (WebCore::DocumentTimeline::animate): If the WeakPtr m_document was destroyed, throw a
+ TypeError exception so that the call to WebAnimation::create won't cause a null ptr deref.
+
2021-12-22 Youenn Fablet <[email protected]>
Use requester when calling updateRequestAndAddExtraFields
Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (287353 => 287354)
--- trunk/Source/WebCore/animation/DocumentTimeline.cpp 2021-12-22 10:13:07 UTC (rev 287353)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp 2021-12-22 12:31:35 UTC (rev 287354)
@@ -499,7 +499,8 @@
ExceptionOr<Ref<WebAnimation>> DocumentTimeline::animate(Ref<CustomEffectCallback>&& callback, std::optional<std::variant<double, CustomAnimationOptions>>&& options)
{
- ASSERT(m_document);
+ if (!m_document)
+ return Exception { InvalidStateError };
String id = "";
std::optional<std::variant<double, EffectTiming>> customEffectOptions;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes