diff mbox series

[FFmpeg-devel,5/6] avformat/genh: Check block_align for how it will be used in SDX2_DPCM

Message ID 20201017220842.17409-5-michael@niedermayer.cc
State Accepted
Commit c95b47e18fdb43a4c667ae22a5d3a5ee6cf7782d
Headers show
Series [FFmpeg-devel,1/6] avformat/asfdec_f: Check for negative ext_len
Related show

Checks

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

Commit Message

Michael Niedermayer Oct. 17, 2020, 10:08 p.m. UTC
Fixes: signed integer overflow: 19922944 * 1024 cannot be represented in type 'int'
Fixes: 26402/clusterfuzz-testcase-minimized-ffmpeg_dem_VMD_fuzzer-5745470053548032

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

Comments

Michael Niedermayer Oct. 23, 2020, 8:04 a.m. UTC | #1
On Sun, Oct 18, 2020 at 12:08:41AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 19922944 * 1024 cannot be represented in type 'int'
> Fixes: 26402/clusterfuzz-testcase-minimized-ffmpeg_dem_VMD_fuzzer-5745470053548032
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/genh.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/genh.c b/libavformat/genh.c
index 61adf49964..ed9910503d 100644
--- a/libavformat/genh.c
+++ b/libavformat/genh.c
@@ -87,7 +87,9 @@  static int genh_read_header(AVFormatContext *s)
     case  5: st->codecpar->codec_id = st->codecpar->block_align > 0 ?
                                    AV_CODEC_ID_PCM_S8_PLANAR :
                                    AV_CODEC_ID_PCM_S8;           break;
-    case  6: st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM;        break;
+    case  6: if (st->codecpar->block_align > INT_MAX/1024)
+                 return AVERROR_INVALIDDATA;
+             st->codecpar->codec_id = AV_CODEC_ID_SDX2_DPCM;        break;
     case  7: ret = ff_alloc_extradata(st->codecpar, 2);
              if (ret < 0)
                  return ret;