- 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 committed by drfrag
parent d1ec7c8cfd
commit 06f84d2420

View file

@ -1498,7 +1498,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);
@ -1564,7 +1564,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);