From a8526585cb55b375101ad97d0078f840dd2f8728 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 25 Sep 2021 14:52:34 +0200 Subject: [PATCH] patterns: Fixed string access --- plugins/libimhex/include/hex/pattern_language/ast_node.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp index d82ed4841..ce1955986 100644 --- a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp @@ -1323,8 +1323,10 @@ namespace hex::pl { [&, this](auto &&assignmentValue) { LogConsole::abortEvaluation(hex::format("cannot assign '{}' to string", pattern->getTypeName()), this); } }, literal); } - else - evaluator->getProvider()->read(pattern->getOffset(), value.data(), pattern->getSize()); + else { + value.resize(pattern->getSize()); + evaluator->getProvider()->read(pattern->getOffset(), value.data(), value.size()); + } literal = value; } else if (auto bitfieldFieldPattern = dynamic_cast(pattern)) {