diff mbox series

[FFmpeg-devel,1/2] avcodec/mjpegdec: Check for unsupported bayer case

Message ID 20220918215704.13793-1-michael@niedermayer.cc
State Accepted
Commit dd81cc22b3dd5bd6badf012b4fe4c19e062650f4
Headers show
Series [FFmpeg-devel,1/2] avcodec/mjpegdec: Check for unsupported bayer case | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Sept. 18, 2022, 9:57 p.m. UTC
Fixes: out of array access
Fixes: 51462/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-662559341582745

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/mjpegdec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Sept. 21, 2022, 9:44 a.m. UTC | #1
On Sun, Sep 18, 2022 at 11:57:03PM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 51462/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-662559341582745
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mjpegdec.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply this

[...]
diff mbox series

Patch

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 65337360b05..e0e1971715a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1212,6 +1212,8 @@  static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
                 ptr[3*mb_x + 2] = buffer[mb_x][2] + ptr[3*mb_x + 1];
             }
         } else if (s->bayer) {
+            if (s->bits <= 8)
+                return AVERROR_PATCHWELCOME;
             if (nb_components == 1) {
                 /* Leave decoding to the TIFF/DNG decoder (see comment in ff_mjpeg_decode_sof) */
                 for (mb_x = 0; mb_x < width; mb_x++)