Skip to content

Commit

Permalink
Fix product integer overflow (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoOkuma authored Oct 24, 2023
1 parent de79ed3 commit e822aa8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion iohub/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ def _gen_chunks(self, input_chunks):
# it's OK if a single image is larger than MAX_CHUNK_SIZE
while (
chunks[-3] > 1
and np.prod(chunks) * bytes_per_pixel > MAX_CHUNK_SIZE
and np.prod(chunks, dtype=np.int64) * bytes_per_pixel
> MAX_CHUNK_SIZE
):
chunks[-3] = np.ceil(chunks[-3] / 2).astype(int)

Expand Down

0 comments on commit e822aa8

Please sign in to comment.