Title: [295719] trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h
Revision
295719
Author
achristen...@apple.com
Date
2022-06-21 20:22:54 -0700 (Tue, 21 Jun 2022)

Log Message

std::variant decoding with out-of-bounds index should fail instead of decoding the 0'th type
https://bugs.webkit.org/show_bug.cgi?id=241813

Reviewed by Chris Dumez.

* Source/WebKit/Platform/IPC/ArgumentCoders.h:

Canonical link: https://commits.webkit.org/251724@main

Modified Paths

Diff

Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h (295718 => 295719)


--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h	2022-06-22 03:12:18 UTC (rev 295718)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h	2022-06-22 03:22:54 UTC (rev 295719)
@@ -836,7 +836,8 @@
     template<typename Decoder>
     static std::optional<std::variant<Types...>> decode(Decoder& decoder, unsigned i)
     {
-        ASSERT_UNUSED(i, !i);
+        if (i)
+            return std::nullopt;
         std::optional<typename std::variant_alternative<0, std::variant<Types...>>::type> optional;
         decoder >> optional;
         if (!optional)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to