[FFmpeg-cvslog] jvdec: Make sure there is enough data for the id string.

Michael Niedermayer git at videolan.org
Thu Apr 19 22:26:00 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Apr 19 21:43:15 2012 +0200| [2a70d8304dd2f8e97b9b0d2321ffbf6da69093f1] | committer: Michael Niedermayer

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 <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a70d8304dd2f8e97b9b0d2321ffbf6da69093f1
---

 libavformat/jvdec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index fbd4f1e..3977594 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;
 }



More information about the ffmpeg-cvslog mailing list