diff mbox series

[FFmpeg-devel,5/6] avcodec/bonk: Avoid undefined overflow in quant

Message ID 20230111204221.22550-5-michael@niedermayer.cc
State Accepted
Commit 977028f9f4f40efcac3ec9d6c226349dd0020b90
Headers show
Series [FFmpeg-devel,1/6] avcodec/utils: allocate a line more for VC1 and WMV3 | 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 Jan. 11, 2023, 8:42 p.m. UTC
Fixes: signed integer overflow: -2889074 * 2048 cannot be represented in type 'int'
Fixes: 51363/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5660734784143360
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-6617680050520064
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-6743951854141440

No check is done for the overflow as this was rejected in last review, see the ML

Note: the 2nd and 3rd testcase was assigned by ossfuzz to a unrelated theora issue (48567)

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

Comments

Paul B Mahol Jan. 11, 2023, 9:06 p.m. UTC | #1
On 1/11/23, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: signed integer overflow: -2889074 * 2048 cannot be represented in
> type 'int'
> Fixes:
> 51363/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5660734784143360
> Fixes:
> 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-6617680050520064
> Fixes:
> 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-6743951854141440
>
> No check is done for the overflow as this was rejected in last review, see
> the ML
>
> Note: the 2nd and 3rd testcase was assigned by ossfuzz to a unrelated theora
> issue (48567)
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/bonk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> index 5d736b1563..9e176d5477 100644
> --- a/libavcodec/bonk.c
> +++ b/libavcodec/bonk.c
> @@ -356,7 +356,7 @@ static int bonk_decode(AVCodecContext *avctx, AVFrame
> *frame,
>                  sample++;
>              }
>
> -            sample[0] = predictor_calc_error(s->k, state, s->n_taps,
> s->input_samples[i] * quant);
> +            sample[0] = predictor_calc_error(s->k, state, s->n_taps,
> s->input_samples[i] * (unsigned)quant);
>              sample++;
>          }
>
> --
> 2.17.1
>

LGTM

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Michael Niedermayer Jan. 12, 2023, 2:29 p.m. UTC | #2
On Wed, Jan 11, 2023 at 10:06:44PM +0100, Paul B Mahol wrote:
> On 1/11/23, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > Fixes: signed integer overflow: -2889074 * 2048 cannot be represented in
> > type 'int'
> > Fixes:
> > 51363/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5660734784143360
> > Fixes:
> > 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-6617680050520064
> > Fixes:
> > 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-6743951854141440
> >
> > No check is done for the overflow as this was rejected in last review, see
> > the ML
> >
> > Note: the 2nd and 3rd testcase was assigned by ossfuzz to a unrelated theora
> > issue (48567)
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/bonk.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> > index 5d736b1563..9e176d5477 100644
> > --- a/libavcodec/bonk.c
> > +++ b/libavcodec/bonk.c
> > @@ -356,7 +356,7 @@ static int bonk_decode(AVCodecContext *avctx, AVFrame
> > *frame,
> >                  sample++;
> >              }
> >
> > -            sample[0] = predictor_calc_error(s->k, state, s->n_taps,
> > s->input_samples[i] * quant);
> > +            sample[0] = predictor_calc_error(s->k, state, s->n_taps,
> > s->input_samples[i] * (unsigned)quant);
> >              sample++;
> >          }
> >
> > --
> > 2.17.1
> >
> 
> LGTM

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
index 5d736b1563..9e176d5477 100644
--- a/libavcodec/bonk.c
+++ b/libavcodec/bonk.c
@@ -356,7 +356,7 @@  static int bonk_decode(AVCodecContext *avctx, AVFrame *frame,
                 sample++;
             }
 
-            sample[0] = predictor_calc_error(s->k, state, s->n_taps, s->input_samples[i] * quant);
+            sample[0] = predictor_calc_error(s->k, state, s->n_taps, s->input_samples[i] * (unsigned)quant);
             sample++;
         }