Change RELEASE_ASSERT in DocumentWriter::addData to ASSERT and early return
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jul 2019 21:50:31 +0000 (21:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jul 2019 21:50:31 +0000 (21:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199756
<rdar://problem/51554775>

Patch by Alex Christensen <achristensen@webkit.org> on 2019-07-12
Reviewed by Brady Eidson.

Attempts to reach this assertion were unsuccessful, but sometimes this assertion crashes.
Let's change it to an early return to prevent crashes.

* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::addData):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247399 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentWriter.cpp

index 956a97c..3d225fd 100644 (file)
@@ -1,3 +1,17 @@
+2019-07-12  Alex Christensen  <achristensen@webkit.org>
+
+        Change RELEASE_ASSERT in DocumentWriter::addData to ASSERT and early return
+        https://bugs.webkit.org/show_bug.cgi?id=199756
+        <rdar://problem/51554775>
+
+        Reviewed by Brady Eidson.
+
+        Attempts to reach this assertion were unsuccessful, but sometimes this assertion crashes.
+        Let's change it to an early return to prevent crashes.
+
+        * loader/DocumentWriter.cpp:
+        (WebCore::DocumentWriter::addData):
+
 2019-07-12  Justin Fan  <justin_fan@apple.com>
 
         [WebGPU] Move error scopes out of GPUDevice for more portable error generation
index 9f5903f..d16d805 100644 (file)
@@ -237,7 +237,10 @@ void DocumentWriter::addData(const char* bytes, size_t length)
 {
     // FIXME: Change these to ASSERT once https://bugs.webkit.org/show_bug.cgi?id=80427 has been resolved.
     RELEASE_ASSERT(m_state != State::NotStarted);
-    RELEASE_ASSERT(m_state != State::Finished);
+    if (m_state == State::Finished) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
     ASSERT(m_parser);
     m_parser->appendBytes(*this, bytes, length);
 }