Skip to content

Commit

Permalink
added missing file size validation in the voxel loader, anything belo…
Browse files Browse the repository at this point in the history
…w 772 bytes cannot be a valid KVX file.
  • Loading branch information
prof-hastig authored and coelckers committed Apr 8, 2024
1 parent f796e55 commit 0c5780c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/common/models/voxels.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 0c5780c

Please sign in to comment.