diff mbox series

[FFmpeg-devel,1/5] avcodec/dpx: Check bits_per_color earlier

Message ID 20210413154539.16739-1-michael@niedermayer.cc
State Accepted
Commit c093eb30311b7148a4da1c7555498187c8cdf0db
Headers show
Series [FFmpeg-devel,1/5] avcodec/dpx: Check bits_per_color earlier | expand

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 13, 2021, 3:45 p.m. UTC
Fixes: shift exponent 251 is too large for 32-bit type 'int'
Fixes: 32147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DPX_fuzzer-5519111675314176

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

Comments

Michael Niedermayer April 17, 2021, 2:55 p.m. UTC | #1
On Tue, Apr 13, 2021 at 05:45:35PM +0200, Michael Niedermayer wrote:
> Fixes: shift exponent 251 is too large for 32-bit type 'int'
> Fixes: 32147/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DPX_fuzzer-5519111675314176
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/dpx.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index 5372e3d586..b02996f04c 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -242,6 +242,9 @@  static int decode_frame(AVCodecContext *avctx,
         return AVERROR_PATCHWELCOME;
     }
 
+    if (bits_per_color > 32)
+        return AVERROR_INVALIDDATA;
+
     buf += 820;
     avctx->sample_aspect_ratio.num = read32(&buf, endian);
     avctx->sample_aspect_ratio.den = read32(&buf, endian);