- reject all DMX sounds shorter than or equal 8 bytes.

8 bytes is the minimum header size for DMX, so for one byte of sample data it has to be 9 bytes.
This was causing access to invalid memory when trying to read the header of something too short.
For other file formats this is of no concern because none has a header this short.
This commit is contained in:
Christoph Oelckers 2019-03-02 21:09:45 +01:00
parent 580c55f8a5
commit 0f184a0f28

View file

@ -1490,7 +1490,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
DPrintf(DMSG_NOTIFY, "Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
int size = Wads.LumpLength(sfx->lumpnum);
if (size > 0)
if (size > 8)
{
auto wlump = Wads.OpenLumpReader(sfx->lumpnum);
auto sfxdata = wlump.Read(size);
@ -1556,7 +1556,7 @@ static void S_LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
else
{
int size = Wads.LumpLength(sfx->lumpnum);
if (size <= 0) return;
if (size <= 8) return;
auto wlump = Wads.OpenLumpReader(sfx->lumpnum);
auto sfxdata = wlump.Read(size);