avpriv_mpeg4audio_get_config: check init_get_bits() return code.
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 27 Jan 2013 20:17:32 +0000 (21:17 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 27 Jan 2013 20:18:00 +0000 (21:18 +0100)
Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpeg4audio.c

index 8aa3219..68448e6 100644 (file)
@@ -84,10 +84,8 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
     GetBitContext gb;
     int specific_config_bitindex;
 
-    if(bit_size<=0)
+    if (bit_size <= 0 || init_get_bits(&gb, buf, bit_size) < 0)
         return AVERROR_INVALIDDATA;
-
-    init_get_bits(&gb, buf, bit_size);
     c->object_type = get_object_type(&gb);
     c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
     c->chan_config = get_bits(&gb, 4);