diff mbox series

[FFmpeg-devel] avcodec/utils: treat PAL8 for jpegs similar to other colorspaces

Message ID 20210429200937.8825-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avcodec/utils: treat PAL8 for jpegs similar to other colorspaces
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer April 29, 2021, 8:09 p.m. UTC
Fixes: out of array access
Fixes: 33713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5778775641030656

Related to: c8197f73e684b0edc450f3dc2b2b4b3fb9dedd0d

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

Comments

Michael Niedermayer May 4, 2021, 12:21 p.m. UTC | #1
On Thu, Apr 29, 2021 at 10:09:37PM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 33713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5778775641030656
> 
> Related to: c8197f73e684b0edc450f3dc2b2b4b3fb9dedd0d
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/utils.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e5e239fd98..afb11e718d 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -272,6 +272,14 @@  void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
             w_align = 8;
             h_align = 8;
         }
+        if (s->codec_id == AV_CODEC_ID_MJPEG   ||
+            s->codec_id == AV_CODEC_ID_MJPEGB  ||
+            s->codec_id == AV_CODEC_ID_LJPEG   ||
+            s->codec_id == AV_CODEC_ID_SMVJPEG ||
+            s->codec_id == AV_CODEC_ID_JPEGLS) {
+            w_align =   8;
+            h_align = 2*8;
+        }
         break;
     case AV_PIX_FMT_BGR24:
         if ((s->codec_id == AV_CODEC_ID_MSZH) ||