diff mbox

[FFmpeg-devel,3/3] avcodec/atrac9dec: Check grad_range[1] more tightly

Message ID 20190803231608.10534-3-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Aug. 3, 2019, 11:16 p.m. UTC
Alternatively the array could be made bigger but the extra values
would not be read without other changes.

Fixes: Out of array access
Fixes: 15658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5738260074070016

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

Comments

Lynne Aug. 4, 2019, 12:18 a.m. UTC | #1
Aug 4, 2019, 12:16 AM by michael@niedermayer.cc:

> Alternatively the array could be made bigger but the extra values
> would not be read without other changes.
>
> Fixes: Out of array access
> Fixes: 15658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5738260074070016
>
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/atrac9dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
> index 491e889788..e503e36dbf 100644
> --- a/libavcodec/atrac9dec.c
> +++ b/libavcodec/atrac9dec.c
> @@ -121,7 +121,7 @@ static inline int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b,
>  }
>  b->grad_boundary = get_bits(gb, 4);
>  
> -    if (grad_range[0] >= grad_range[1] || grad_range[1] > 47)
> +    if (grad_range[0] >= grad_range[1] || grad_range[1] > 31)
>  return AVERROR_INVALIDDATA; 
>

Looked into it, lgtm.
Michael Niedermayer Aug. 5, 2019, 3:03 p.m. UTC | #2
On Sun, Aug 04, 2019 at 02:18:19AM +0200, Lynne wrote:
> Aug 4, 2019, 12:16 AM by michael@niedermayer.cc:
> 
> > Alternatively the array could be made bigger but the extra values
> > would not be read without other changes.
> >
> > Fixes: Out of array access
> > Fixes: 15658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5738260074070016
> >
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/atrac9dec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
> > index 491e889788..e503e36dbf 100644
> > --- a/libavcodec/atrac9dec.c
> > +++ b/libavcodec/atrac9dec.c
> > @@ -121,7 +121,7 @@ static inline int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b,
> >  }
> >  b->grad_boundary = get_bits(gb, 4);
> >  
> > -    if (grad_range[0] >= grad_range[1] || grad_range[1] > 47)
> > +    if (grad_range[0] >= grad_range[1] || grad_range[1] > 31)
> >  return AVERROR_INVALIDDATA; 
> >
> 
> Looked into it, lgtm.

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index 491e889788..e503e36dbf 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -121,7 +121,7 @@  static inline int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b,
     }
     b->grad_boundary = get_bits(gb, 4);
 
-    if (grad_range[0] >= grad_range[1] || grad_range[1] > 47)
+    if (grad_range[0] >= grad_range[1] || grad_range[1] > 31)
         return AVERROR_INVALIDDATA;
 
     av_assert0(grad_value[0] <= 31 && grad_value[1] <= 31);