From 4484c722f68e6a54b8bd701d391897bc092b4404 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 Jan 2013 22:36:37 +0100 Subject: [PATCH] alsdec/read_specific_config: check for init_get_bits failure This also fixes a potential integer overflow Reviewed-by: Paul B Mahol Reviewed-by: Thilo Borgmann Signed-off-by: Michael Niedermayer --- libavcodec/alsdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index d7baa6eccb..524be227b3 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -289,8 +289,10 @@ static av_cold int read_specific_config(ALSDecContext *ctx) ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; uint32_t als_id, header_size, trailer_size; + int ret; - init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); + if ((ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size)) < 0) + return ret; config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata, avctx->extradata_size * 8, 1);