[FFmpeg-cvslog] avcodec/diracdec: Fix integer overflow in divide3()

Michael Niedermayer git at videolan.org
Thu Aug 24 15:10:01 EEST 2017


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jul 27 23:49:27 2017 +0200| [95bbbbd14e44ef4c1a1589d1c1dc39245dc72a39] | committer: Michael Niedermayer

avcodec/diracdec: Fix integer overflow in divide3()

Fixes: runtime error: signed integer overflow: -1073746548 * 21845 cannot be represented in type 'int'
Fixes: 2729/clusterfuzz-testcase-minimized-5902915464069120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c0220c768c7fc933a76c863ebbb0abdf68a88533)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=95bbbbd14e44ef4c1a1589d1c1dc39245dc72a39
---

 libavcodec/diracdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 929832b9ce..a718f00992 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -285,7 +285,7 @@ static const int qoffset_inter_tab[MAX_QUANT+1] = {
 /* magic number division by 3 from schroedinger */
 static inline int divide3(int x)
 {
-    return ((x+1)*21845 + 10922) >> 16;
+    return (int)((x+1U)*21845 + 10922) >> 16;
 }
 
 static DiracFrame *remove_frame(DiracFrame *framelist[], int picnum)



More information about the ffmpeg-cvslog mailing list