fix zero length sounds (#1315)

* fix zero length sounds

DSSAWUP sound in "Eviternity II RC1.wad"

* better fix

* another variant
This commit is contained in:
Roman Fomin 2023-12-10 18:20:03 +07:00 committed by GitHub
parent b8c0cebc6d
commit 626021e0eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -589,7 +589,7 @@ boolean I_OAL_CacheSound(sfxinfo_t *sfx)
lumplen = W_LumpLength(lumpnum);
// Check the header, and ensure this is a valid sound
if (lumpdata[0] == 0x03 && lumpdata[1] == 0x00)
if (lumplen > DMXHDRSIZE && lumpdata[0] == 0x03 && lumpdata[1] == 0x00)
{
freq = (lumpdata[3] << 8) | lumpdata[2];
size = (lumpdata[7] << 24) | (lumpdata[6] << 16) |