[FFmpeg-cvslog] avcodec/hcadec: Check or bound indexes
Michael Niedermayer
git at videolan.org
Mon Jun 8 21:53:25 EEST 2020
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed May 13 19:54:42 2020 +0200| [b7e5c8f67d82550daacce58fae97e1fe3d3fb9aa] | committer: Michael Niedermayer
avcodec/hcadec: Check or bound indexes
This causes indexes into scale_conversion_table to wrap around, alternatively they
could be clipped, the table be enlarged or we can error out. I have not found a document that specifies
what is the correct way to handle this
Fixes: out of array access
Fixes: 21727/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5752477891952640.fuzz
Fixes: 22438/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5640717790871552
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7e5c8f67d82550daacce58fae97e1fe3d3fb9aa
---
libavcodec/hcadec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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];
}
}
More information about the ffmpeg-cvslog
mailing list