commit | 59ac6b75adaa1f39ba565f0e4250348ac2530842 | [log] [tgz] |
---|---|---|
author | achristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Wed Jun 22 03:22:54 2022 +0000 |
committer | achristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Wed Jun 22 03:22:54 2022 +0000 |
tree | 6e75c3196b0a62ed4655eb5223ac33ca58307c68 | |
parent | 4e1c286f0447cb2ccda5843ee6edfa4a1fc8e9e5 [diff] |
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 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@295719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/Platform/IPC/ArgumentCoders.h b/Source/WebKit/Platform/IPC/ArgumentCoders.h index 5e58c2c..3f7334d 100644 --- a/Source/WebKit/Platform/IPC/ArgumentCoders.h +++ b/Source/WebKit/Platform/IPC/ArgumentCoders.h
@@ -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)