From 61f733282849d250045824b8bea9127e8564ec22 Mon Sep 17 00:00:00 2001 From: peterhillman Date: Sat, 2 Oct 2021 14:19:45 +1300 Subject: [PATCH] fix int overflow in calc_level_size (#1166) Signed-off-by: Peter Hillman --- src/lib/OpenEXRCore/parse_header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/OpenEXRCore/parse_header.c b/src/lib/OpenEXRCore/parse_header.c index 233610c2ea..63df3c803a 100644 --- a/src/lib/OpenEXRCore/parse_header.c +++ b/src/lib/OpenEXRCore/parse_header.c @@ -1949,7 +1949,7 @@ static int64_t calc_level_size (int mind, int maxd, int level, exr_tile_round_mode_t rounding) { int64_t dsize = (int64_t) maxd - (int64_t) mind + 1; - int b = (1 << level); + int64_t b = ( (int64_t) 1) << level; int64_t retsize = dsize / b; if (rounding == EXR_TILE_ROUND_UP && retsize * b < dsize) retsize += 1;