[FFmpeg-devel] [PATCH 1/3] avcodec/mjpegdec: Limit bayer to single plane outputting format

Michael Niedermayer michael at niedermayer.cc
Sat Jul 4 15:45:51 EEST 2020


This reduces the number of paths reachable with DNG and should
improve security

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/mjpegdec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index cb5e2a9b9b..e7a4e08c1c 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -499,6 +499,11 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
             }
         }
 
+        if (s->bayer) {
+            if (pix_fmt_id != 0x11110000 && pix_fmt_id != 0x11000000)
+                goto unk_pixfmt;
+        }
+
         switch (pix_fmt_id) {
         case 0x11110000: /* for bayer-encoded huffman lossless JPEGs embedded in DNGs */
             if (!s->bayer)
-- 
2.17.1



More information about the ffmpeg-devel mailing list