diff mbox series

[FFmpeg-devel,3/3] avformat/mov: Check sample size for overflow in mov_parse_stsd_audio()

Message ID 20210317231728.2130-3-michael@niedermayer.cc
State Accepted
Commit d35677736a59ec6579b4da63d9b1444986ba339e
Headers show
Series [FFmpeg-devel,1/3] avformat/mpc8: check for size overflow in mpc8_get_chunk_header()
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 March 17, 2021, 11:17 p.m. UTC
Fixes: signed integer overflow: 2 * 1914708000 cannot be represented in type 'int'
Fixes: 31639/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6303428239294464

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

Comments

Michael Niedermayer March 25, 2021, 5:09 p.m. UTC | #1
On Thu, Mar 18, 2021 at 12:17:28AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 2 * 1914708000 cannot be represented in type 'int'
> Fixes: 31639/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6303428239294464
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f9c4dbe5d4..3729e7d0bb 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2263,7 +2263,7 @@  static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
     }
 
     bits_per_sample = av_get_bits_per_sample(st->codecpar->codec_id);
-    if (bits_per_sample) {
+    if (bits_per_sample && (bits_per_sample >> 3) * (uint64_t)st->codecpar->channels <= INT_MAX) {
         st->codecpar->bits_per_coded_sample = bits_per_sample;
         sc->sample_size = (bits_per_sample >> 3) * st->codecpar->channels;
     }