From 83c43e4d52dadc08c38f5f42bf6cdf1e2e72b11c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=96man?= <andreas@olebyn.nu>
Date: Thu, 19 Jul 2007 15:56:56 +0000
Subject: [PATCH] =?UTF-8?q?bail=20out=20on=20unknown=20jpeg=20pixel=20form?=
 =?UTF-8?q?at=20instead=20of=20silently=20decoding=20data=20incorrectly=20?=
 =?UTF-8?q?patch=20by=20Andreas=20=C3=96man=20%=20andreas=20A=20olebyn=20P?=
 =?UTF-8?q?=20nu=20%=20Original=20thread:=20date:=20Jul=2019,=202007=204:5?=
 =?UTF-8?q?0=20PM=20subject:=20[FFmpeg-devel]=20[PATCH]=20bail=20out=20on?=
 =?UTF-8?q?=20unknown=20jpeg=20pixel=20format?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Originally committed as revision 9764 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/mjpegdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index d65a3463cff..aa8d2e4f601 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -305,10 +305,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
     case 0x221212:
         s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P;
         break;
-    default:
     case 0x221111:
         s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420P;
         break;
+    default:
+        av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id);
+        return -1;
     }
     if(s->ls){
         if(s->nb_components > 1)
-- 
GitLab