X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Faic.c;h=cf5b0782bebcaa3a401c580799546f918f9d4766;hb=930391e5988abe126d29c5e9b09fab459e0b8936;hp=9c6f806655e3e19149e6a71d890ba4cc73bfd20a;hpb=03210fe138f3b3bd7f5272fe29aca810cf517329;p=ffmpeg diff --git a/libavcodec/aic.c b/libavcodec/aic.c index 9c6f806655e..cf5b0782beb 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -22,6 +22,8 @@ #include +#include "libavutil/mem_internal.h" + #include "avcodec.h" #include "bytestream.h" #include "internal.h" @@ -42,9 +44,9 @@ enum AICBands { NUM_BANDS }; -static const int aic_num_band_coeffs[NUM_BANDS] = { 64, 32, 192, 96 }; +static const uint8_t aic_num_band_coeffs[NUM_BANDS] = { 64, 32, 192, 96 }; -static const int aic_band_off[NUM_BANDS] = { 0, 64, 96, 288 }; +static const uint16_t aic_band_off[NUM_BANDS] = { 0, 64, 96, 288 }; static const uint8_t aic_quant_matrix[64] = { 8, 16, 19, 22, 22, 26, 26, 27, @@ -208,6 +210,9 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst, int mb, idx; unsigned val; + if (get_bits_left(gb) < 5) + return AVERROR_INVALIDDATA; + has_skips = get_bits1(gb); coeff_type = get_bits1(gb); coeff_bits = get_bits(gb, 3); @@ -501,6 +506,5 @@ AVCodec ff_aic_decoder = { .close = aic_decode_close, .decode = aic_decode_frame, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, - .init_thread_copy = ONLY_IF_THREADS_ENABLED(aic_decode_init), .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, };