Skip to content
Browse files
std::variant decoding with out-of-bounds index should fail instead of…
… decoding the 0'th type

Reviewed by Chris Dumez.

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

Canonical link:
git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
achristensen07 committed Jun 22, 2022
1 parent 6af6969 commit 79efdcf
Showing 1 changed file with 2 additions and 1 deletion.
@@ -836,7 +836,8 @@ struct VariantCoder<0, Types...> {
template<typename Decoder>
static std::optional<std::variant<Types...>> decode(Decoder& decoder, unsigned i)
if (i)
return std::nullopt;
std::optional<typename std::variant_alternative<0, std::variant<Types...>>::type> optional;
decoder >> optional;
if (!optional)

0 comments on commit 79efdcf

Please sign in to comment.