Title: [258902] trunk/Source/WebKit
Revision
258902
Author
ddkil...@apple.com
Date
2020-03-23 20:20:41 -0700 (Mon, 23 Mar 2020)

Log Message

IPC::Decoder::decodeFixedLengthData() should be marked WARN_UNUSED_RETURN
<https://webkit.org/b/209448>
<rdar://problem/60797998>

Reviewed by Chris Dumez.

* Platform/IPC/ArgumentCoders.h:
(struct VectorArgumentCoder::decode):
- Check the return value of Decoder::decodeFixedLengthData().
* Platform/IPC/Decoder.h:
(IPC::Decoder::decodeFixedLengthData): Add WARN_UNUSED_RETURN.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (258901 => 258902)


--- trunk/Source/WebKit/ChangeLog	2020-03-24 03:02:28 UTC (rev 258901)
+++ trunk/Source/WebKit/ChangeLog	2020-03-24 03:20:41 UTC (rev 258902)
@@ -1,3 +1,17 @@
+2020-03-23  David Kilzer  <ddkil...@apple.com>
+
+        IPC::Decoder::decodeFixedLengthData() should be marked WARN_UNUSED_RETURN
+        <https://webkit.org/b/209448>
+        <rdar://problem/60797998>
+
+        Reviewed by Chris Dumez.
+
+        * Platform/IPC/ArgumentCoders.h:
+        (struct VectorArgumentCoder::decode):
+        - Check the return value of Decoder::decodeFixedLengthData().
+        * Platform/IPC/Decoder.h:
+        (IPC::Decoder::decodeFixedLengthData): Add WARN_UNUSED_RETURN.
+
 2020-03-23  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Remove the unused method PasteboardStrategy::uniqueName()

Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h (258901 => 258902)


--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h	2020-03-24 03:02:28 UTC (rev 258901)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h	2020-03-24 03:20:41 UTC (rev 258902)
@@ -380,7 +380,10 @@
         Vector<T, inlineCapacity, OverflowHandler, minCapacity> temp;
         temp.grow(size);
 
-        decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T), alignof(T));
+        if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T), alignof(T))) {
+            decoder.markInvalid();
+            return false;
+        }
 
         vector.swap(temp);
         return true;
@@ -402,9 +405,12 @@
         
         Vector<T, inlineCapacity, OverflowHandler, minCapacity> vector;
         vector.grow(size);
-        
-        decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(vector.data()), size * sizeof(T), alignof(T));
-        
+
+        if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(vector.data()), size * sizeof(T), alignof(T))) {
+            decoder.markInvalid();
+            return WTF::nullopt;
+        }
+
         return vector;
     }
 };

Modified: trunk/Source/WebKit/Platform/IPC/Decoder.h (258901 => 258902)


--- trunk/Source/WebKit/Platform/IPC/Decoder.h	2020-03-24 03:02:28 UTC (rev 258901)
+++ trunk/Source/WebKit/Platform/IPC/Decoder.h	2020-03-24 03:20:41 UTC (rev 258902)
@@ -78,7 +78,7 @@
     }
     void markInvalid() { m_bufferPos = nullptr; }
 
-    bool decodeFixedLengthData(uint8_t*, size_t, unsigned alignment);
+    bool decodeFixedLengthData(uint8_t*, size_t, unsigned alignment) WARN_UNUSED_RETURN;
 
     // The data in the data reference here will only be valid for the lifetime of the ArgumentDecoder object.
     bool decodeVariableLengthByteArray(DataReference&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to