aacdec: Fix null pointer crash
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 17 Dec 2011 04:02:11 +0000 (05:02 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Jan 2012 18:05:12 +0000 (19:05 +0100)
Fixes bug170
Bug found by: Gautam Gupta

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f37b2d5a6884c7bea87a6c7454239381449bd637)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpeg4audio.c

index 6744593..abd3fa4 100644 (file)
@@ -82,6 +82,9 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
     GetBitContext gb;
     int specific_config_bitindex;
 
+    if(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);