[FFmpeg-devel] [PATCH] improved sierravmd probe function

Reimar Döffinger Reimar.Doeffinger
Mon Sep 14 20:02:24 CEST 2009


Hello,
I don't consider it particularly strong, but it also passes the second
probetest, so I guess it must be an improvement.
Index: libavformat/sierravmd.c
===================================================================
--- libavformat/sierravmd.c     (revision 19840)
+++ libavformat/sierravmd.c     (working copy)
@@ -61,10 +61,17 @@
 
 static int vmd_probe(AVProbeData *p)
 {
+    int w, h;
+    if (p->buf_size < 16)
+        return 0;
     /* check if the first 2 bytes of the file contain the appropriate * size
      * of a VMD header chunk */
     if (AV_RL16(&p->buf[0]) != VMD_HEADER_SIZE - 2)
         return 0;
+    w = AV_RL16(&p->buf[12]);
+    h = AV_RL16(&p->buf[14]);
+    if (!w || w > 2048 || !h || h > 2048)
+        return 0;
 
     /* only return half certainty since this check is a bit sketchy */
     return AVPROBE_SCORE_MAX / 2;




More information about the ffmpeg-devel mailing list