mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- 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:
parent
580c55f8a5
commit
0f184a0f28
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue