Skip to content

Commit

Permalink
more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Jan 8, 2025
1 parent 2e424ed commit 56d9ed7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions neo/rawio/micromedrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ def _parse_header(self):
# "TRONCA" zone define segments
zname2, pos, length = zones["TRONCA"]
f.seek(pos)
# this number avoid a infinite loop in case of corrupted TRONCA zone (seg_start!=0 and trace_offset!=0)
max_segments = 100
self.info_segments = []
for i in range(max_segments):
# 4 bytes u4 each
seg_start = int(np.frombuffer(f.read(4), dtype="u4")[0])
trace_offset = int(np.frombuffer(f.read(4), dtype="u4")[0])
if seg_start == 0 and trace_offset == 0:
Expand Down

0 comments on commit 56d9ed7

Please sign in to comment.