Skip to content

Commit

Permalink
fix: fix size overflow (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 authored Feb 28, 2025
1 parent d896d19 commit b51c7a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nd2/nd2file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import inspect
import math
import threading
import warnings
from itertools import product
Expand Down Expand Up @@ -749,7 +750,8 @@ def components_per_channel(self) -> int:
@property
def size(self) -> int:
"""Total number of voxels in the volume (the product of the shape)."""
return int(np.prod(self.shape))
# don't use np.prod... due to potential overflow
return int(math.prod(self.shape))

@property
def nbytes(self) -> int:
Expand Down

0 comments on commit b51c7a2

Please sign in to comment.