From 940b1b617521860130fd83c895bd4ab352f86d44 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 15 Feb 2020 15:40:40 +1100 Subject: [PATCH] Fix invalid memory access when getting the main entry of empty registers Fixes #3370 --- src/register_manager.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/register_manager.hh b/src/register_manager.hh index f18bc989..d82849c3 100644 --- a/src/register_manager.hh +++ b/src/register_manager.hh @@ -48,7 +48,8 @@ public: const String& get_main(const Context& context, size_t main_index) override { - return get(context)[std::min(main_index, m_content.size() - 1)]; + auto content = get(context); + return content[std::min(main_index, content.size() - 1)]; } protected: