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 committed Apr 8, 2024
1 parent 7a43d7f commit cbbaf5e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/common/models/voxels.cpp
Original file line number Diff line number Diff line change
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 cbbaf5e

Please sign in to comment.