summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-07-28 22:15:47 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-07-28 22:15:47 +0200
commitd6654d906c1ae66590b6d600458a91f1ee923de5 (patch)
tree531c66c4aa765a27a3cdf4af1e09fe9ec1ea4b00 /src/lib
parent361c4506fdfb9b6f0e41d86d5d0ea1efb5704ecf (diff)
opj_int_ceildiv(): fix int32 overflow. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2494. Credit to OSS Fuzz
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/opj_intmath.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/openjp2/opj_intmath.h b/src/lib/openjp2/opj_intmath.h
index 03a446f1..64c87ed9 100644
--- a/src/lib/openjp2/opj_intmath.h
+++ b/src/lib/openjp2/opj_intmath.h
@@ -129,7 +129,7 @@ Divide an integer and round upwards
static INLINE OPJ_INT32 opj_int_ceildiv(OPJ_INT32 a, OPJ_INT32 b)
{
assert(b);
- return (a + b - 1) / b;
+ return (OPJ_INT32)(((OPJ_INT64)a + b - 1) / b);
}
/**