[FFmpeg-devel,1/6] avcodec/vp3: Check for end of input in vp4_unpack_vlcs()

Submitted by Michael Niedermayer on Aug. 2, 2019, 11:49 p.m.

Details

Message ID 20190802234957.11098-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Aug. 2, 2019, 11:49 p.m.
Fixes: Timeout (too long -> 1sec)
Fixes: 15232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5769583086010368

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

Comments

Peter Ross Aug. 3, 2019, 1:45 a.m.
On Sat, Aug 03, 2019 at 01:49:52AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (too long -> 1sec)
> Fixes: 15232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5769583086010368
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vp3.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> index 6ce901eda9..28ed0461c7 100644
> --- a/libavcodec/vp3.c
> +++ b/libavcodec/vp3.c
> @@ -1403,6 +1403,8 @@ static int vp4_unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
>      int eob_run;
>  
>      while (!eob_tracker[coeff_i]) {
> +        if (get_bits_left(gb) < 1)
> +            return AVERROR_INVALIDDATA;
>  
>          token = get_vlc2(gb, vlc_tables[coeff_i]->table, 11, 3);
>  

approve.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
Michael Niedermayer Aug. 3, 2019, 10:06 a.m.
On Sat, Aug 03, 2019 at 11:45:17AM +1000, Peter Ross wrote:
> On Sat, Aug 03, 2019 at 01:49:52AM +0200, Michael Niedermayer wrote:
> > Fixes: Timeout (too long -> 1sec)
> > Fixes: 15232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5769583086010368
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/vp3.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> > index 6ce901eda9..28ed0461c7 100644
> > --- a/libavcodec/vp3.c
> > +++ b/libavcodec/vp3.c
> > @@ -1403,6 +1403,8 @@ static int vp4_unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
> >      int eob_run;
> >  
> >      while (!eob_tracker[coeff_i]) {
> > +        if (get_bits_left(gb) < 1)
> > +            return AVERROR_INVALIDDATA;
> >  
> >          token = get_vlc2(gb, vlc_tables[coeff_i]->table, 11, 3);
> >  
> 
> approve.

will apply

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 6ce901eda9..28ed0461c7 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1403,6 +1403,8 @@  static int vp4_unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
     int eob_run;
 
     while (!eob_tracker[coeff_i]) {
+        if (get_bits_left(gb) < 1)
+            return AVERROR_INVALIDDATA;
 
         token = get_vlc2(gb, vlc_tables[coeff_i]->table, 11, 3);