From: Michael Niedermayer Date: Thu, 19 Apr 2012 19:43:15 +0000 (+0200) Subject: jvdec: Make sure there is enough data for the id string. X-Git-Tag: android-x86-4.4-r1~12295 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2a70d8304dd2f8e97b9b0d2321ffbf6da69093f1;p=android-x86%2Fexternal-ffmpeg.git jvdec: Make sure there is enough data for the id string. Previously too little data could lead to a false detection. Signed-off-by: Michael Niedermayer --- diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index fbd4f1e5f4..3977594f8b 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -52,8 +52,8 @@ typedef struct { static int read_probe(AVProbeData *pd) { - if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && - !memcmp(pd->buf + 4, MAGIC, FFMIN(strlen(MAGIC), pd->buf_size - 4))) + if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) <= pd->buf_size - 4 && + !memcmp(pd->buf + 4, MAGIC, strlen(MAGIC))) return AVPROBE_SCORE_MAX; return 0; }