From cbbaf5e6d7bc7fb9002ffa2274d77fbb0eeb6d01 Mon Sep 17 00:00:00 2001 From: Professor Hastig Date: Mon, 8 Apr 2024 09:47:46 +0200 Subject: [PATCH] added missing file size validation in the voxel loader, anything below 772 bytes cannot be a valid KVX file. --- src/common/models/voxels.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/models/voxels.cpp b/src/common/models/voxels.cpp index a2e371582c7..4d13323530d 100644 --- a/src/common/models/voxels.cpp +++ b/src/common/models/voxels.cpp @@ -164,6 +164,7 @@ FVoxel *R_LoadKVX(int lumpnum) auto lump = fileSystem.ReadFile(lumpnum); // FileData adds an extra 0 byte to the end. auto rawvoxel = lump.bytes(); int voxelsize = (int)(lump.size()); + if (voxelsize <= 768 + 4) return nullptr; // Oh, KVX, why couldn't you have a proper header? We'll just go through // and collect each MIP level, doing lots of range checking, and if the