diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c index f25d6c39b6..5fa87319d2 100644 --- a/libavcodec/hcadec.c +++ b/libavcodec/hcadec.c @@ -286,8 +286,8 @@ static void reconstruct_hfr(HCAContext *s, ChannelContext *ch, return; for (int i = 0, k = start_band, l = start_band - 1; i < hfr_group_count; i++){ - for (int j = 0; j < bands_per_hfr_group && k < total_band_count; j++, k++, l--){ - ch->imdct_in[k] = scale_conversion_table[ch->hfr_scale[i] - ch->scale_factors[l]] * ch->imdct_in[l]; + for (int j = 0; j < bands_per_hfr_group && k < total_band_count && l >= 0; j++, k++, l--){ + ch->imdct_in[k] = scale_conversion_table[ (ch->hfr_scale[i] - ch->scale_factors[l]) & 63 ] * ch->imdct_in[l]; } }