OSDN Git Service

mpeg4audio: correctly propagate meaningful error values
authorJames Almer <jamrial@gmail.com>
Wed, 30 Nov 2016 14:12:40 +0000 (11:12 -0300)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Fri, 2 Dec 2016 17:16:30 +0000 (12:16 -0500)
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/mpeg4audio.c

index 2363cb6..af8e655 100644 (file)
 static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c)
 {
     if (get_bits_left(gb) < 112)
-        return -1;
+        return AVERROR_INVALIDDATA;
 
     if (get_bits_long(gb, 32) != MKBETAG('A','L','S','\0'))
-        return -1;
+        return AVERROR_INVALIDDATA;
 
     // override AudioSpecificConfig channel configuration and sample rate
     // which are buggy in old ALS conformance files
@@ -116,8 +116,9 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
 
         specific_config_bitindex = get_bits_count(&gb);
 
-        if (parse_config_ALS(&gb, c))
-            return -1;
+        ret = parse_config_ALS(&gb, c);
+        if (ret < 0)
+            return ret;
     }
 
     if (c->ext_object_type != AOT_SBR && sync_extension) {