Fix crash when plugin has missing text section (#6264)

This commit is contained in:
PabloMK7 2023-01-27 14:06:35 +01:00 committed by GitHub
parent 84e54a52a6
commit 0f6478a928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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> char_data(max_size);