Skip to content

Commit 88ea672

Browse files
authored
Fix overflow when computing seek position (#341)
1 parent d2cddeb commit 88ea672

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nptdms/tdms_segment.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ def read_raw_data_for_channel(self, f, channel_path, chunk_offset=0, num_chunks=
264264
data_objects = [o for o in self.ordered_objects if o.has_data]
265265
chunk_size = self._get_chunk_size()
266266

267+
# Ensure we're working with Python ints as np.int32 values could overflow
268+
# (https://github.com/adamreeve/npTDMS/issues/338)
269+
chunk_size = int(chunk_size)
270+
chunk_offset = int(chunk_offset)
271+
267272
if chunk_offset > 0:
268273
f.seek(chunk_size * chunk_offset, os.SEEK_CUR)
269274
stop_chunk = self.num_chunks if num_chunks is None else num_chunks + chunk_offset

0 commit comments

Comments
 (0)