Commit e6f34a8d authored by reimar's avatar reimar

Check the index validity more thoroughly for the c93 probe function.

In particular, check that length of the first index entries is not 0 since
that is interpreted "end of file" and makes no sense in the very first entries.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19843 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 92a2cb38
......@@ -21,6 +21,7 @@
#include "avformat.h"
#include "voc.h"
#include "libavutil/intreadwrite.h"
typedef struct {
uint16_t index;
......@@ -43,13 +44,16 @@ typedef struct {
static int probe(AVProbeData *p)
{
if (p->buf[0] == 0x01 && p->buf[1] == 0x00 &&
p->buf[4] == 0x01 + p->buf[2] &&
p->buf[8] == p->buf[4] + p->buf[6] &&
p->buf[12] == p->buf[8] + p->buf[10])
return AVPROBE_SCORE_MAX;
int i;
int index = 1;
if (p->buf_size < 16)
return 0;
for (i = 0; i < 16; i += 4) {
if (AV_RL16(p->buf + i) != index || !p->buf[i + 2] || !p->buf[i + 3])
return 0;
index += p->buf[i + 2];
}
return AVPROBE_SCORE_MAX;
}
static int read_header(AVFormatContext *s,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment