Skip to content

Commit 5ee6eec

Browse files
author
Grok Compression
committed
TileCompletion: fix overflow
1 parent c8cab49 commit 5ee6eec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/core/tile_processor/TileCompletion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class TileCompletion
4848
if(imageWidth == 0 || imageHeight == 0 || tileWidth == 0 || tileHeight == 0)
4949
throw std::invalid_argument("Dimensions must be positive");
5050

51-
numTileCols_ = static_cast<uint16_t>((imageWidth + tileWidth - 1) / tileWidth);
52-
numTileRows_ = static_cast<uint16_t>((imageHeight + tileHeight - 1) / tileHeight);
51+
numTileCols_ = static_cast<uint16_t>(((uint64_t)imageWidth + tileWidth - 1) / tileWidth);
52+
numTileRows_ = static_cast<uint16_t>(((uint64_t)imageHeight + tileHeight - 1) / tileHeight);
5353

5454
// Default to full region if subregion is not provided
5555
if(tileSubRegion.has_value())

0 commit comments

Comments
 (0)