[util] Allow zero-sized lumps to be at end of file

This fixes a crash when attempting to load a map with no texture data.
This commit is contained in:
Bill Currie 2022-05-26 12:35:50 +09:00
parent 70ece6d5bb
commit dcfe0e33a3

View file

@ -683,7 +683,7 @@ do { \
size_t size = LittleLong (bsp29->header->lumps[l].filelen); \
size_t offs = LittleLong (bsp29->header->lumps[l].fileofs); \
void *data = (byte *) mem + offs; \
if (offs >= mem_size || (offs + size) > mem_size) \
if (offs > mem_size || (offs + size) > mem_size) \
Sys_Error ("invalid lump"); \
bsp29->n = 0; \
if (size) \