mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-04-20 09:55:38 +00:00
correct checks when reading wav chunk header
This commit is contained in:
parent
131d4e8de7
commit
356fcebf84
1 changed files with 12 additions and 1 deletions
|
@ -68,13 +68,24 @@ static int WAV_ReadChunkInfo(const fshandle_t *fh, char *name)
|
|||
|
||||
name[4] = 0;
|
||||
|
||||
if (ftell(fh->file) >= (fh->start + fh->length))
|
||||
{
|
||||
return -1; /* End of WAV file */
|
||||
}
|
||||
|
||||
r = fread(name, 1, 4, fh->file);
|
||||
if (r != 4)
|
||||
return -1;
|
||||
|
||||
len = FGetLittleLong(fh->file);
|
||||
if (len < 0 || (ftell(fh->file) + len) > (fh->start + fh->length))
|
||||
if (len < 0)
|
||||
{
|
||||
//Con_Printf("WAV: Negative chunk length\n");
|
||||
return -1;
|
||||
}
|
||||
if ((ftell(fh->file) + len) > (fh->start + fh->length))
|
||||
{
|
||||
//Con_Printf("WAV: Chunk extends past end of file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue