diff mbox

[FFmpeg-devel,5/5] avcodec/vc1dec: Fix "return -1" cases

Message ID 20191216231946.11260-5-michael@niedermayer.cc
State Accepted
Commit 26f040bcb4a1db78d1311af2e69de6984ecb43e5
Headers show

Commit Message

Michael Niedermayer Dec. 16, 2019, 11:19 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vc1dec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jun Zhao Dec. 17, 2019, 1:10 a.m. UTC | #1
On Tue, Dec 17, 2019 at 7:23 AM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vc1dec.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index d2f25fabec..fcc482e7eb 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -431,7 +431,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
>      v->output_height = avctx->height;
>
>      if (!avctx->extradata_size || !avctx->extradata)
> -        return -1;
> +        return AVERROR_INVALIDDATA;
>      v->s.avctx = avctx;
>
>      if ((ret = ff_vc1_init_common(v)) < 0)
> @@ -472,7 +472,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
>
>          if (avctx->extradata_size < 16) {
>              av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size);
> -            return -1;
> +            return AVERROR_INVALIDDATA;
>          }
>
>          buf2  = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
> @@ -508,7 +508,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
>          av_free(buf2);
>          if (!seq_initialized || !ep_initialized) {
>              av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
> -            return -1;
> +            return AVERROR_INVALIDDATA;
>          }
>          v->res_sprite = (avctx->codec_id == AV_CODEC_ID_VC1IMAGE);
>      }
> @@ -577,7 +577,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
>              v->sprite_height > 1 << 14 ||
>              v->output_width  > 1 << 14 ||
>              v->output_height > 1 << 14) {
> -            ret = -1;
> +            ret = AVERROR_INVALIDDATA;
>              goto error;
>          }
>
> --
LGTM
Michael Niedermayer Dec. 27, 2019, 9:50 p.m. UTC | #2
On Tue, Dec 17, 2019 at 09:10:57AM +0800, mypopy@gmail.com wrote:
> On Tue, Dec 17, 2019 at 7:23 AM Michael Niedermayer
> <michael@niedermayer.cc> wrote:
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/vc1dec.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> > index d2f25fabec..fcc482e7eb 100644
> > --- a/libavcodec/vc1dec.c
> > +++ b/libavcodec/vc1dec.c
> > @@ -431,7 +431,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
> >      v->output_height = avctx->height;
> >
> >      if (!avctx->extradata_size || !avctx->extradata)
> > -        return -1;
> > +        return AVERROR_INVALIDDATA;
> >      v->s.avctx = avctx;
> >
> >      if ((ret = ff_vc1_init_common(v)) < 0)
> > @@ -472,7 +472,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
> >
> >          if (avctx->extradata_size < 16) {
> >              av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size);
> > -            return -1;
> > +            return AVERROR_INVALIDDATA;
> >          }
> >
> >          buf2  = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
> > @@ -508,7 +508,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
> >          av_free(buf2);
> >          if (!seq_initialized || !ep_initialized) {
> >              av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
> > -            return -1;
> > +            return AVERROR_INVALIDDATA;
> >          }
> >          v->res_sprite = (avctx->codec_id == AV_CODEC_ID_VC1IMAGE);
> >      }
> > @@ -577,7 +577,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
> >              v->sprite_height > 1 << 14 ||
> >              v->output_width  > 1 << 14 ||
> >              v->output_height > 1 << 14) {
> > -            ret = -1;
> > +            ret = AVERROR_INVALIDDATA;
> >              goto error;
> >          }
> >
> > --
> LGTM

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index d2f25fabec..fcc482e7eb 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -431,7 +431,7 @@  static av_cold int vc1_decode_init(AVCodecContext *avctx)
     v->output_height = avctx->height;
 
     if (!avctx->extradata_size || !avctx->extradata)
-        return -1;
+        return AVERROR_INVALIDDATA;
     v->s.avctx = avctx;
 
     if ((ret = ff_vc1_init_common(v)) < 0)
@@ -472,7 +472,7 @@  static av_cold int vc1_decode_init(AVCodecContext *avctx)
 
         if (avctx->extradata_size < 16) {
             av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size);
-            return -1;
+            return AVERROR_INVALIDDATA;
         }
 
         buf2  = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
@@ -508,7 +508,7 @@  static av_cold int vc1_decode_init(AVCodecContext *avctx)
         av_free(buf2);
         if (!seq_initialized || !ep_initialized) {
             av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
-            return -1;
+            return AVERROR_INVALIDDATA;
         }
         v->res_sprite = (avctx->codec_id == AV_CODEC_ID_VC1IMAGE);
     }
@@ -577,7 +577,7 @@  static av_cold int vc1_decode_init(AVCodecContext *avctx)
             v->sprite_height > 1 << 14 ||
             v->output_width  > 1 << 14 ||
             v->output_height > 1 << 14) {
-            ret = -1;
+            ret = AVERROR_INVALIDDATA;
             goto error;
         }