From 0f6478a928195cb9e2c157bc2c9e586aded302c7 Mon Sep 17 00:00:00 2001 From: PabloMK7 Date: Fri, 27 Jan 2023 14:06:35 +0100 Subject: [PATCH] Fix crash when plugin has missing text section (#6264) --- src/core/file_sys/plugin_3gx.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/file_sys/plugin_3gx.cpp b/src/core/file_sys/plugin_3gx.cpp index e59d39090..61928982d 100644 --- a/src/core/file_sys/plugin_3gx.cpp +++ b/src/core/file_sys/plugin_3gx.cpp @@ -26,7 +26,8 @@ #include "core/loader/loader.h" static std::string ReadTextInfo(FileUtil::IOFile& file, std::size_t offset, std::size_t max_size) { - if (max_size > 0x400) { // Limit read string size to 0x400 bytes, just in case + if (offset == 0 || max_size == 0 || + max_size > 0x400) { // Limit read string size to 0x400 bytes, just in case return ""; } std::vector char_data(max_size);