aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-07-27 23:49:27 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-07-29 14:23:25 +0200
commit6b1c71040d170c66b20d214a17aacefc215cd9c5 (patch)
treeb899059c949150cc5ec1b57577f166ff5f46bd03
parent6274709c1c110cbb714a2bd0292bb9e96d9d561f (diff)
downloadffmpeg-6b1c71040d170c66b20d214a17aacefc215cd9c5.tar.gz
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@niedermayer.cc> (cherry picked from commit c0220c768c7fc933a76c863ebbb0abdf68a88533) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/diracdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 160085f852..42518c2681 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -231,7 +231,7 @@ enum dirac_subband {
/* 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)