From 1fe9d405f5c4811eb6073cf5fc6622842192e06b Mon Sep 17 00:00:00 2001 From: Alex Rebert Date: Thu, 28 Oct 2021 22:36:11 -0400 Subject: [PATCH] Fix out-of-bounds read in MDLImporter Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24502 --- code/AssetLib/MDL/MDLLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/MDL/MDLLoader.cpp b/code/AssetLib/MDL/MDLLoader.cpp index 40475021b..c59375da0 100644 --- a/code/AssetLib/MDL/MDLLoader.cpp +++ b/code/AssetLib/MDL/MDLLoader.cpp @@ -600,7 +600,7 @@ void MDLImporter::InternReadFile_3DGS_MDL345() { // need to read all textures for (unsigned int i = 0; i < (unsigned int)pcHeader->num_skins; ++i) { - if (szCurrent >= szEnd) { + if (szCurrent + sizeof(uint32_t) > szEnd) { throw DeadlyImportError("Texture data past end of file."); } BE_NCONST MDL::Skin *pcSkin;