diff mbox series

[FFmpeg-devel,6/7] avcodec/bonk: Check step against overflow

Message ID 20221106123430.1668-6-michael@niedermayer.cc
State Accepted
Commit 32631852259a8aeb845c39ed7fa707c6e102c40a
Headers show
Series [FFmpeg-devel,1/7] avcodec/bonk: Use unsigned in predictor_calc_error() to avoid undefined overflows | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Nov. 6, 2022, 12:34 p.m. UTC
No testcase

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/bonk.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paul B Mahol Nov. 6, 2022, 6:25 p.m. UTC | #1
On 11/6/22, Michael Niedermayer <michael@niedermayer.cc> wrote:
> No testcase
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/bonk.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> index 37ad7854b6..f2427de4f1 100644
> --- a/libavcodec/bonk.c
> +++ b/libavcodec/bonk.c
> @@ -180,6 +180,8 @@ static int intlist_read(BonkContext *s, int *buf, int
> entries, int base_2_part)
>              if (!dominant)
>                  n_zeros += steplet;
>
> +            if (step > INT32_MAX*8LL/9 + 1)
> +                return AVERROR_INVALIDDATA;
>              step += step / 8;
>          } else if (steplet > 0) {
>              int actual_run = read_uint_max(s, steplet - 1);
> --
> 2.17.1

probably ok

>
> _______________________________________________
> 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 Nov. 10, 2022, 7:43 p.m. UTC | #2
On Sun, Nov 06, 2022 at 07:25:35PM +0100, Paul B Mahol wrote:
> On 11/6/22, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > No testcase
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/bonk.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> > index 37ad7854b6..f2427de4f1 100644
> > --- a/libavcodec/bonk.c
> > +++ b/libavcodec/bonk.c
> > @@ -180,6 +180,8 @@ static int intlist_read(BonkContext *s, int *buf, int
> > entries, int base_2_part)
> >              if (!dominant)
> >                  n_zeros += steplet;
> >
> > +            if (step > INT32_MAX*8LL/9 + 1)
> > +                return AVERROR_INVALIDDATA;
> >              step += step / 8;
> >          } else if (steplet > 0) {
> >              int actual_run = read_uint_max(s, steplet - 1);
> > --
> > 2.17.1
> 
> probably ok

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
index 37ad7854b6..f2427de4f1 100644
--- a/libavcodec/bonk.c
+++ b/libavcodec/bonk.c
@@ -180,6 +180,8 @@  static int intlist_read(BonkContext *s, int *buf, int entries, int base_2_part)
             if (!dominant)
                 n_zeros += steplet;
 
+            if (step > INT32_MAX*8LL/9 + 1)
+                return AVERROR_INVALIDDATA;
             step += step / 8;
         } else if (steplet > 0) {
             int actual_run = read_uint_max(s, steplet - 1);