Skip to content

Commit

Permalink
avoid potential (not likely) overflow in tile count calc
Browse files Browse the repository at this point in the history
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Apr 29, 2024
1 parent 0a1749d commit ee6e4f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/OpenEXR/ImfTiledInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,13 @@ TiledInputFile::tileOrder (int dx[], int dy[], int lx[], int ly[]) const
case ONE_LEVEL:
case MIPMAP_LEVELS:
for (int i_l = 0; i_l < numY; ++i_l)
numAllTiles += numXTiles (i_l) * numYTiles (i_l);
numAllTiles += size_t (numXTiles (i_l)) * size_t (numYTiles (i_l));
break;

case RIPMAP_LEVELS:
for (int i_ly = 0; i_ly < numY; ++i_ly)
for (int i_lx = 0; i_lx < numX; ++i_lx)
numAllTiles += numXTiles (i_lx) * numYTiles (i_ly);
numAllTiles += size_t (numXTiles (i_lx)) * size_t (numYTiles (i_ly));
break;

default:
Expand Down

0 comments on commit ee6e4f1

Please sign in to comment.