diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 9fefe95f1c..6e1e06517f 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1021,6 +1021,10 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd) ALSSpecificConfig *sconf = &ctx->sconf; *bd->shift_lsbs = 0; + + if (get_bits_left(gb) < 1) + return AVERROR_INVALIDDATA; + // read block type flag and read the samples accordingly if (get_bits1(gb)) { ret = read_var_block_data(ctx, bd);