Skip to content

Commit

Permalink
fix int overflow in calc_level_size (AcademySoftwareFoundation#1166)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman authored and cary-ilm committed Oct 13, 2021
1 parent 319ec14 commit 61f7332
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/OpenEXRCore/parse_header.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 61f7332

Please sign in to comment.