[FFmpeg-cvslog] avformat/img2dec: improve bmp probe

Michael Niedermayer git at videolan.org
Fri Jul 4 05:05:49 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jul  4 04:54:52 2014 +0200| [c277ab6b78892bcd748b3e9d8cd4891b3764a025] | committer: Michael Niedermayer

avformat/img2dec: improve bmp probe

fix probetest failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/img2dec.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index cc53409..b1fa8cc 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -564,13 +564,20 @@ AVInputFormat ff_image2pipe_demuxer = {
 static int bmp_probe(AVProbeData *p)
 {
     const uint8_t *b = p->buf;
+    int ihsize;
 
-    if (AV_RB16(b) == 0x424d)
-        if (!AV_RN32(b + 6)) {
-            return AVPROBE_SCORE_EXTENSION + 1;
-        } else {
-            return AVPROBE_SCORE_EXTENSION / 4;
-        }
+    if (AV_RB16(b) != 0x424d)
+        return 0;
+
+    ihsize = AV_RL32(b+14);
+    if (ihsize < 12 || ihsize > 255)
+        return 0;
+
+    if (!AV_RN32(b + 6)) {
+        return AVPROBE_SCORE_EXTENSION + 1;
+    } else {
+        return AVPROBE_SCORE_EXTENSION / 4;
+    }
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list