1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avcodec/vorbisdec: fix FASTDIV usage for vr_type == 2

This reverts a hunk from f1ca40ee00

Fixes: out of array read
Fixes: 16924/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-5157893162139648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 722fd46965)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-09-06 12:06:30 +02:00
parent 79e06f4d31
commit eeb1e37e76

View File

@ -1513,7 +1513,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
} }
} else if (vr_type == 2) { } else if (vr_type == 2) {
unsigned voffs_div = FASTDIV(voffset << 1, ch <<1); unsigned voffs_div = ch == 1 ? voffset : FASTDIV(voffset, ch);
unsigned voffs_mod = voffset - voffs_div * ch; unsigned voffs_mod = voffset - voffs_div * ch;
for (k = 0; k < step; ++k) { for (k = 0; k < step; ++k) {