diff mbox

[FFmpeg-devel] avcodec/hapqa_extract: fix two error return values

Message ID 20180313220825.2824-1-jamrial@gmail.com
State Accepted
Commit b173e035362b103e17cc7b394c231c60a4915c59
Headers show

Commit Message

James Almer March 13, 2018, 10:08 p.m. UTC
ret is 0 by default.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/hapqa_extract_bsf.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Martin Vignali March 13, 2018, 11:17 p.m. UTC | #1
2018-03-13 23:08 GMT+01:00 James Almer <jamrial@gmail.com>:

> ret is 0 by default.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/hapqa_extract_bsf.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_
> bsf.c
> index 333efb2e3a..ee5dc191f7 100644
> --- a/libavcodec/hapqa_extract_bsf.c
> +++ b/libavcodec/hapqa_extract_bsf.c
> @@ -66,6 +66,7 @@ static int hapqa_extract(AVBSFContext *bsf, AVPacket
> *pkt)
>
>      if ((section_type & 0x0F) != 0x0D) {
>          av_log(bsf, AV_LOG_ERROR, "Invalid section type for HAPQA
> %#04x.\n", section_type & 0x0F);
> +        ret = AVERROR_INVALIDDATA;
>          goto fail;
>      }
>
> @@ -90,6 +91,7 @@ static int hapqa_extract(AVBSFContext *bsf, AVPacket
> *pkt)
>
>          if (check_texture(ctx, section_type) == 0){ /* the second texture
> is not the one to keep */
>              av_log(bsf, AV_LOG_ERROR, "No valid texture found.\n");
> +            ret = AVERROR_INVALIDDATA;
>              goto fail;
>          }
>      }
> --


lgtm, thanks.

Martin
James Almer March 13, 2018, 11:58 p.m. UTC | #2
On 3/13/2018 8:17 PM, Martin Vignali wrote:
> 2018-03-13 23:08 GMT+01:00 James Almer <jamrial@gmail.com>:
> 
>> ret is 0 by default.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/hapqa_extract_bsf.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_
>> bsf.c
>> index 333efb2e3a..ee5dc191f7 100644
>> --- a/libavcodec/hapqa_extract_bsf.c
>> +++ b/libavcodec/hapqa_extract_bsf.c
>> @@ -66,6 +66,7 @@ static int hapqa_extract(AVBSFContext *bsf, AVPacket
>> *pkt)
>>
>>      if ((section_type & 0x0F) != 0x0D) {
>>          av_log(bsf, AV_LOG_ERROR, "Invalid section type for HAPQA
>> %#04x.\n", section_type & 0x0F);
>> +        ret = AVERROR_INVALIDDATA;
>>          goto fail;
>>      }
>>
>> @@ -90,6 +91,7 @@ static int hapqa_extract(AVBSFContext *bsf, AVPacket
>> *pkt)
>>
>>          if (check_texture(ctx, section_type) == 0){ /* the second texture
>> is not the one to keep */
>>              av_log(bsf, AV_LOG_ERROR, "No valid texture found.\n");
>> +            ret = AVERROR_INVALIDDATA;
>>              goto fail;
>>          }
>>      }
>> --
> 
> 
> lgtm, thanks.
> 
> Martin

Pushed.
diff mbox

Patch

diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_bsf.c
index 333efb2e3a..ee5dc191f7 100644
--- a/libavcodec/hapqa_extract_bsf.c
+++ b/libavcodec/hapqa_extract_bsf.c
@@ -66,6 +66,7 @@  static int hapqa_extract(AVBSFContext *bsf, AVPacket *pkt)
 
     if ((section_type & 0x0F) != 0x0D) {
         av_log(bsf, AV_LOG_ERROR, "Invalid section type for HAPQA %#04x.\n", section_type & 0x0F);
+        ret = AVERROR_INVALIDDATA;
         goto fail;
     }
 
@@ -90,6 +91,7 @@  static int hapqa_extract(AVBSFContext *bsf, AVPacket *pkt)
 
         if (check_texture(ctx, section_type) == 0){ /* the second texture is not the one to keep */
             av_log(bsf, AV_LOG_ERROR, "No valid texture found.\n");
+            ret = AVERROR_INVALIDDATA;
             goto fail;
         }
     }