diff mbox

[FFmpeg-devel,4/4] avcodec/vorbisdec: fix FASTDIV usage for vr_type == 2

Message ID 20190906104747.10286-4-michael@niedermayer.cc
State Accepted
Commit 722fd4696583cc984700eaec4745922ae177b2da
Headers show

Commit Message

Michael Niedermayer Sept. 6, 2019, 10:47 a.m. UTC
This reverts a hunk from f1ca40ee00402102046fc7e59606651930436b0e

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>
---
 libavcodec/vorbisdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 6, 2019, 6:59 p.m. UTC | #1
On Fri, Sep 06, 2019 at 12:47:47PM +0200, Michael Niedermayer wrote:
> This reverts a hunk from f1ca40ee00402102046fc7e59606651930436b0e
> 
> 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>
> ---
>  libavcodec/vorbisdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply this, so it will make it in for 4.2.1 

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 104dc86a13..be6d1b2d21 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1513,7 +1513,7 @@  static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
                                 }
 
                             } 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;
 
                                 for (k = 0; k < step; ++k) {