From 2d7373402d971a32903e2ed598cfc75a83e70f74 Mon Sep 17 00:00:00 2001 From: Abit Date: Sun, 1 Oct 2023 10:50:44 +0200 Subject: [PATCH] Avoid potential corruption: unpack(static_variant) --- include/fc/io/raw.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/fc/io/raw.hpp b/include/fc/io/raw.hpp index 4fa6076b..6e385832 100644 --- a/include/fc/io/raw.hpp +++ b/include/fc/io/raw.hpp @@ -889,8 +889,9 @@ namespace fc { --_max_depth; unsigned_int w; fc::raw::unpack( s, w, _max_depth ); - sv.set_which(w.value); - sv.visit( unpack_static_variant( s, _max_depth ) ); + static_variant helper( static_cast::tag_type>(w.value) ); + helper.visit( unpack_static_variant( s, _max_depth ) ); + sv = helper; } } } // namespace fc::raw