diff mbox

[FFmpeg-devel,2/3] avcodec/atrac9dec: Replace impossible conditions by assert

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

Commit Message

Michael Niedermayer Aug. 3, 2019, 11:16 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/atrac9dec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Lynne Aug. 3, 2019, 11:41 p.m. UTC | #1
Aug 4, 2019, 12:16 AM by michael@niedermayer.cc:

> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/atrac9dec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
> index 2e23ea44e8..491e889788 100644
> --- a/libavcodec/atrac9dec.c
> +++ b/libavcodec/atrac9dec.c
> @@ -124,8 +124,7 @@ static inline int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b,
>  if (grad_range[0] >= grad_range[1] || grad_range[1] > 47)
>  return AVERROR_INVALIDDATA;
>  
> -    if (grad_value[0] > 31 || grad_value[1] > 31)
> -        return AVERROR_INVALIDDATA;
> +    av_assert0(grad_value[0] <= 31 && grad_value[1] <= 31);
>

Its impossible so just remove it.
Michael Niedermayer Aug. 5, 2019, 3:03 p.m. UTC | #2
On Sun, Aug 04, 2019 at 01:41:48AM +0200, Lynne wrote:
> Aug 4, 2019, 12:16 AM by michael@niedermayer.cc:
> 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/atrac9dec.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
> > index 2e23ea44e8..491e889788 100644
> > --- a/libavcodec/atrac9dec.c
> > +++ b/libavcodec/atrac9dec.c
> > @@ -124,8 +124,7 @@ static inline int parse_gradient(ATRAC9Context *s, ATRAC9BlockData *b,
> >  if (grad_range[0] >= grad_range[1] || grad_range[1] > 47)
> >  return AVERROR_INVALIDDATA;
> >  
> > -    if (grad_value[0] > 31 || grad_value[1] > 31)
> > -        return AVERROR_INVALIDDATA;
> > +    av_assert0(grad_value[0] <= 31 && grad_value[1] <= 31);
> >
> 
> Its impossible so just remove it.

will do

thx

[...]
diff mbox

Patch

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