[FFmpeg-devel] [PATCH]lavc/mjpegdec: Fix decoding images with Adobe_CM tag

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Feb 24 18:52:13 CET 2016


Hi!

Attached patch fixes ticket #5267 for me.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 69c9cf3..87c1501 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1677,7 +1677,11 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
         goto out;
     }
 
-    if (id == AV_RB32("Adob") && (get_bits(&s->gb, 8) == 'e')) {
+    if (   id == AV_RB32("Adob")
+        && len >= 7
+        && show_bits(&s->gb, 8) == 'e'
+        && show_bits(&s->gb, 24) != 'e' << 24 | '_' << 16 | 'C') {
+        skip_bits(&s->gb,  8); /* 'e' */
         skip_bits(&s->gb, 16); /* version */
         skip_bits(&s->gb, 16); /* flags0 */
         skip_bits(&s->gb, 16); /* flags1 */


More information about the ffmpeg-devel mailing list