Title: [260861] trunk/Source/WebKit
Revision
260861
Author
[email protected]
Date
2020-04-28 20:03:09 -0700 (Tue, 28 Apr 2020)

Log Message

IPC::Decoder::isValid() should just be a nullptr check
<https://webkit.org/b/211152>
<rdar://problem/62552699>

Reviewed by Darin Adler.

* Platform/IPC/Decoder.h:
(IPC::Decoder::isValid const): Change to nullptr check.  I
reviewed the code in Decoder.{cpp,h}, and I didn't see
m_bufferPos being set without a bounds check.  Also added
WARN_UNUSED_RETURN to make sure the result is always checked.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260860 => 260861)


--- trunk/Source/WebKit/ChangeLog	2020-04-29 02:59:52 UTC (rev 260860)
+++ trunk/Source/WebKit/ChangeLog	2020-04-29 03:03:09 UTC (rev 260861)
@@ -1,3 +1,17 @@
+2020-04-28  David Kilzer  <[email protected]>
+
+        IPC::Decoder::isValid() should just be a nullptr check
+        <https://webkit.org/b/211152>
+        <rdar://problem/62552699>
+
+        Reviewed by Darin Adler.
+
+        * Platform/IPC/Decoder.h:
+        (IPC::Decoder::isValid const): Change to nullptr check.  I
+        reviewed the code in Decoder.{cpp,h}, and I didn't see
+        m_bufferPos being set without a bounds check.  Also added
+        WARN_UNUSED_RETURN to make sure the result is always checked.
+
 2020-04-28  Daniel Bates  <[email protected]>
 
         Move WebPage::textInputContextsInRect() to WebPageIOS.mm

Modified: trunk/Source/WebKit/Platform/IPC/Decoder.h (260860 => 260861)


--- trunk/Source/WebKit/Platform/IPC/Decoder.h	2020-04-29 02:59:52 UTC (rev 260860)
+++ trunk/Source/WebKit/Platform/IPC/Decoder.h	2020-04-29 03:03:09 UTC (rev 260861)
@@ -71,12 +71,7 @@
 
     size_t length() const { return m_bufferEnd - m_buffer; }
 
-    bool isValid() const
-    {
-        // (m_bufferPos == m_bufferEnd) is a valid state for decoding if the last parameter
-        // is a variable length byte array and its size == 0.
-        return m_bufferPos >= m_buffer && m_bufferPos <= m_bufferEnd;
-    }
+    WARN_UNUSED_RETURN bool isValid() const { return m_bufferPos != nullptr; }
     void markInvalid() { m_bufferPos = nullptr; }
 
     WARN_UNUSED_RETURN bool decodeFixedLengthData(uint8_t*, size_t, unsigned alignment);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to