mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
Don't crash on invalid input in the Microsoft Wave reader. /bigfoot
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2949 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5852614cf5
commit
9bda9e9fc1
1 changed files with 9 additions and 4 deletions
|
@ -933,17 +933,22 @@ int GetLittleLong(void)
|
|||
|
||||
void FindNextChunk(char *name)
|
||||
{
|
||||
unsigned int dataleft;
|
||||
|
||||
while (1)
|
||||
{
|
||||
data_p=last_chunk;
|
||||
data_p += 4;
|
||||
if (data_p >= iff_end)
|
||||
dataleft = iff_end - last_chunk;
|
||||
if (dataleft < 8)
|
||||
{ // didn't find the chunk
|
||||
data_p = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
data_p=last_chunk;
|
||||
data_p += 4;
|
||||
dataleft-= 8;
|
||||
iff_chunk_len = GetLittleLong();
|
||||
if (iff_chunk_len < 0)
|
||||
if (iff_chunk_len < 0 || iff_chunk_len > dataleft)
|
||||
{
|
||||
data_p = NULL;
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue