diff mbox series

[FFmpeg-devel,3/6] avformat/iamf_parse: Check for 0 samples

Message ID 20240731195410.274508-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] avcodec/cbs: sei_3d_reference_displays_info uses length 0 elements | 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 July 31, 2024, 7:54 p.m. UTC
Fixes: division by zero
Fixes: 70561/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6199435013455872
Fixes: 70565/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5783790316748800

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

Comments

James Almer July 31, 2024, 10:04 p.m. UTC | #1
On 7/31/2024 4:54 PM, Michael Niedermayer wrote:
> Fixes: division by zero
> Fixes: 70561/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6199435013455872
> Fixes: 70565/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5783790316748800
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>   libavformat/iamf_parse.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
> index cdfd5f75fef..e007d6a7af2 100644
> --- a/libavformat/iamf_parse.c
> +++ b/libavformat/iamf_parse.c
> @@ -252,7 +252,7 @@ static int codec_config_obu(void *s, IAMFContext *c, AVIOContext *pb, int len)
>       if (ret < 0)
>           goto fail;
>   
> -    if ((codec_config->nb_samples > INT_MAX) ||
> +    if ((codec_config->nb_samples > INT_MAX) || codec_config->nb_samples <= 0 ||
>           (-codec_config->audio_roll_distance > INT_MAX / codec_config->nb_samples)) {
>           ret = AVERROR_INVALIDDATA;
>           goto fail;

LGTM
diff mbox series

Patch

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index cdfd5f75fef..e007d6a7af2 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -252,7 +252,7 @@  static int codec_config_obu(void *s, IAMFContext *c, AVIOContext *pb, int len)
     if (ret < 0)
         goto fail;
 
-    if ((codec_config->nb_samples > INT_MAX) ||
+    if ((codec_config->nb_samples > INT_MAX) || codec_config->nb_samples <= 0 ||
         (-codec_config->audio_roll_distance > INT_MAX / codec_config->nb_samples)) {
         ret = AVERROR_INVALIDDATA;
         goto fail;