mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-13 07:47:45 +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)
|
void FindNextChunk(char *name)
|
||||||
{
|
{
|
||||||
|
unsigned int dataleft;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
data_p=last_chunk;
|
dataleft = iff_end - last_chunk;
|
||||||
data_p += 4;
|
if (dataleft < 8)
|
||||||
if (data_p >= iff_end)
|
|
||||||
{ // didn't find the chunk
|
{ // didn't find the chunk
|
||||||
data_p = NULL;
|
data_p = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data_p=last_chunk;
|
||||||
|
data_p += 4;
|
||||||
|
dataleft-= 8;
|
||||||
iff_chunk_len = GetLittleLong();
|
iff_chunk_len = GetLittleLong();
|
||||||
if (iff_chunk_len < 0)
|
if (iff_chunk_len < 0 || iff_chunk_len > dataleft)
|
||||||
{
|
{
|
||||||
data_p = NULL;
|
data_p = NULL;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue