From aae93691b9923e13af089a2a092fdd75bbfab489 Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Sat, 4 Nov 2023 09:59:13 +0100 Subject: [PATCH] Fix container overflow in MMD parser Using reserve, buffer size is not updated. Since data is directly inserted and not using push_pack, this can lead to a container overflow. --- code/AssetLib/MMD/MMDPmxParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/MMD/MMDPmxParser.cpp b/code/AssetLib/MMD/MMDPmxParser.cpp index ca37ba199..42e835c66 100644 --- a/code/AssetLib/MMD/MMDPmxParser.cpp +++ b/code/AssetLib/MMD/MMDPmxParser.cpp @@ -93,7 +93,7 @@ namespace pmx { return std::string(); } - buffer.reserve(size); + buffer.resize(size); stream->read((char*) buffer.data(), size); if (encoding == 0) {