From: Stefan BrĂ¼ns Date: Tue, 24 Nov 2015 19:55:14 +0000 (+0100) Subject: input/wav: increase search range for data chunk, report errors X-Git-Tag: libsigrok-0.4.0~88 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b944e336d60cb9948b757f47a97b9f3bf145f534;p=libsigrok.git input/wav: increase search range for data chunk, report errors --- diff --git a/src/input/wav.c b/src/input/wav.c index d1299cd3..e04a0016 100644 --- a/src/input/wav.c +++ b/src/input/wav.c @@ -37,7 +37,7 @@ #define MIN_DATA_CHUNK_OFFSET 45 /* Expect to find the "data" chunk within this offset from the start. */ -#define MAX_DATA_CHUNK_OFFSET 256 +#define MAX_DATA_CHUNK_OFFSET 1024 #define WAVE_FORMAT_PCM_ 0x0001 #define WAVE_FORMAT_IEEE_FLOAT_ 0x0003 @@ -175,6 +175,9 @@ static int find_data_chunk(GString *buf, int initial_offset) offset += 8 + RL32(buf->str + offset + 4); } + if (offset > MAX_DATA_CHUNK_OFFSET) + return -1; + return offset; }