diff mbox series

[FFmpeg-devel,3/7] avcodec/bonk: Remove special 32bit case from read_uint_max()

Message ID 20221106123430.1668-3-michael@niedermayer.cc
State Accepted
Commit 00b489b168f20a25ce901c6068e1727edf58d612
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
This case seems not to match the reference decoder and it also
seems not reachable

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

Comments

Paul B Mahol Nov. 6, 2022, 6:28 p.m. UTC | #1
On 11/6/22, Michael Niedermayer <michael@niedermayer.cc> wrote:
> This case seems not to match the reference decoder and it also
> seems not reachable
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/bonk.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> index 04ea4def2f..fca8c246aa 100644
> --- a/libavcodec/bonk.c
> +++ b/libavcodec/bonk.c
> @@ -136,8 +136,7 @@ static unsigned read_uint_max(BonkContext *s, uint32_t
> max)
>      if (max == 0)
>          return 0;
>
> -    if (max >> 31)
> -        return 32;
> +    av_assert0(max >> 31 == 0);
>
>      for (unsigned i = 1; i <= max - value; i+=i)
>          if (get_bits1(&s->gb))
> --
> 2.17.1


Not sure, at your risk.

Test lossy mode too.

>
> _______________________________________________
> 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. 14, 2022, 8:32 p.m. UTC | #2
On Sun, Nov 06, 2022 at 07:28:48PM +0100, Paul B Mahol wrote:
> On 11/6/22, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > This case seems not to match the reference decoder and it also
> > seems not reachable
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/bonk.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
> > index 04ea4def2f..fca8c246aa 100644
> > --- a/libavcodec/bonk.c
> > +++ b/libavcodec/bonk.c
> > @@ -136,8 +136,7 @@ static unsigned read_uint_max(BonkContext *s, uint32_t
> > max)
> >      if (max == 0)
> >          return 0;
> >
> > -    if (max >> 31)
> > -        return 32;
> > +    av_assert0(max >> 31 == 0);
> >
> >      for (unsigned i = 1; i <= max - value; i+=i)
> >          if (get_bits1(&s->gb))
> > --
> > 2.17.1
> 
> 
> Not sure, at your risk.
> 
> Test lossy mode too.

piotr provided me with a larger testset including lossy files
they are all unchanged

will apply this and the other remaining patches.
They look all correct to me, if i am wrong which is always a possibility
iam human ... then you can revert whats wrong of course

thx

[...]
Paul B Mahol Nov. 14, 2022, 8:58 p.m. UTC | #3
On 11/14/22, Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Sun, Nov 06, 2022 at 07:28:48PM +0100, Paul B Mahol wrote:
>> On 11/6/22, Michael Niedermayer <michael@niedermayer.cc> wrote:
>> > This case seems not to match the reference decoder and it also
>> > seems not reachable
>> >
>> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>> > ---
>> >  libavcodec/bonk.c | 3 +--
>> >  1 file changed, 1 insertion(+), 2 deletions(-)
>> >
>> > diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
>> > index 04ea4def2f..fca8c246aa 100644
>> > --- a/libavcodec/bonk.c
>> > +++ b/libavcodec/bonk.c
>> > @@ -136,8 +136,7 @@ static unsigned read_uint_max(BonkContext *s,
>> > uint32_t
>> > max)
>> >      if (max == 0)
>> >          return 0;
>> >
>> > -    if (max >> 31)
>> > -        return 32;
>> > +    av_assert0(max >> 31 == 0);
>> >
>> >      for (unsigned i = 1; i <= max - value; i+=i)
>> >          if (get_bits1(&s->gb))
>> > --
>> > 2.17.1
>>
>>
>> Not sure, at your risk.
>>
>> Test lossy mode too.
>
> piotr provided me with a larger testset including lossy files
> they are all unchanged
>
> will apply this and the other remaining patches.
> They look all correct to me, if i am wrong which is always a possibility
> iam human ... then you can revert whats wrong of course
>

Its not for valid, but for fuzzed files.

> thx
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you drop bombs on a foreign country and kill a hundred thousand
> innocent people, expect your government to call the consequence
> "unprovoked inhuman terrorist attacks" and use it to justify dropping
> more bombs and killing more people. The technology changed, the idea is
> old.
>
diff mbox series

Patch

diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c
index 04ea4def2f..fca8c246aa 100644
--- a/libavcodec/bonk.c
+++ b/libavcodec/bonk.c
@@ -136,8 +136,7 @@  static unsigned read_uint_max(BonkContext *s, uint32_t max)
     if (max == 0)
         return 0;
 
-    if (max >> 31)
-        return 32;
+    av_assert0(max >> 31 == 0);
 
     for (unsigned i = 1; i <= max - value; i+=i)
         if (get_bits1(&s->gb))