diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-08-04 15:00:02 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-08-24 16:13:56 +0200 |
commit | cb31b6ca724774057822ed65a818a41db8072e06 (patch) | |
tree | 8aeaeec9381ddda81a29d032de782834147ac034 | |
parent | b53db58ab78925930e69605b704c4f6ab3ac8c18 (diff) | |
download | ffmpeg-cb31b6ca724774057822ed65a818a41db8072e06.tar.gz |
aac: Check init_get_bits return value
Some code paths can call it with invalid length.
CC: libav-stable@libav.org
(cherry picked from commit 71953ebcf94fe4ef316cdad1f276089205dd1d65)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r-- | libavcodec/aacdec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 7952ac4129..325bf63794 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -789,7 +789,8 @@ static int decode_audio_specific_config(AACContext *ac, av_dlog(avctx, "%02x ", avctx->extradata[i]); av_dlog(avctx, "\n"); - init_get_bits(&gb, data, bit_size); + if ((ret = init_get_bits(&gb, data, bit_size)) < 0) + return ret; if ((i = avpriv_mpeg4audio_get_config(m4ac, data, bit_size, sync_extension)) < 0) @@ -2638,7 +2639,8 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data, } } - init_get_bits(&gb, buf, buf_size * 8); + if ((err = init_get_bits(&gb, buf, buf_size * 8)) < 0) + return err; if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb)) < 0) return err; @@ -2883,7 +2885,8 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out, int muxlength, err; GetBitContext gb; - init_get_bits(&gb, avpkt->data, avpkt->size * 8); + if ((err = init_get_bits(&gb, avpkt->data, avpkt->size * 8)) < 0) + return err; // check for LOAS sync word if (get_bits(&gb, 11) != LOAS_SYNC_WORD) |