[FFmpeg-devel] [PATCH]lavf/img2dec: Return a small score for possibly invalid jpeg files

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Sep 15 17:24:52 CEST 2015


Hi!

I believe that the jpeg probe function should always return 
a small score for files starting with 0xffd8.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 70f0b09..5e3c60b 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -683,17 +683,17 @@ static int jpeg_probe(AVProbeData *p)
         case 0xC6:
         case 0xC7:
             if (state != 0xD8)
-                return 0;
+                return AVPROBE_SCORE_EXTENSION / 8;
             state = 0xC0;
             break;
         case 0xDA:
             if (state != 0xC0)
-                return 0;
+                return AVPROBE_SCORE_EXTENSION / 8;
             state = 0xDA;
             break;
         case 0xD9:
             if (state != 0xDA)
-                return 0;
+                return AVPROBE_SCORE_EXTENSION / 8;
             state = 0xD9;
             break;
         case 0xE0:
@@ -717,7 +717,7 @@ static int jpeg_probe(AVProbeData *p)
         default:
             if (  (c >= 0x02 && c <= 0xBF)
                 || c == 0xC8)
-                return 0;
+                return AVPROBE_SCORE_EXTENSION / 8;
         }
     }
 


More information about the ffmpeg-devel mailing list