Browse code

Make flic probe check a few more things. fixes issue399

Originally committed as revision 14235 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2008/07/15 07:55:07
Showing 1 changed files
... ...
@@ -54,12 +54,25 @@ static int flic_probe(AVProbeData *p)
54 54
 {
55 55
     int magic_number;
56 56
 
57
+    if(p->buf_size < FLIC_HEADER_SIZE)
58
+        return 0;
59
+
57 60
     magic_number = AV_RL16(&p->buf[4]);
58 61
     if ((magic_number != FLIC_FILE_MAGIC_1) &&
59 62
         (magic_number != FLIC_FILE_MAGIC_2) &&
60 63
         (magic_number != FLIC_FILE_MAGIC_3))
61 64
         return 0;
62 65
 
66
+    if(AV_RL16(&p->buf[0x10]) != FLIC_CHUNK_MAGIC_1){
67
+        if(AV_RL32(&p->buf[0x10]) > 2000)
68
+            return 0;
69
+    }
70
+
71
+    if(   AV_RL16(&p->buf[0x08]) > 4096
72
+       || AV_RL16(&p->buf[0x0A]) > 4096)
73
+        return 0;
74
+
75
+
63 76
     return AVPROBE_SCORE_MAX;
64 77
 }
65 78