Skip to content

Spike2RawIO: compute block positions in 64 bits for version 9 files over 2 GiB - #1947

Open
h-mayorquin wants to merge 2 commits into
NeuralEnsemble:masterfrom
h-mayorquin:fix_other_bug
Open

h-mayorquin wants to merge 2 commits into
NeuralEnsemble:masterfrom
h-mayorquin:fix_other_bug

Conversation

@h-mayorquin

Copy link
Copy Markdown
Contributor

While reviewing #1944 I noticed that Spike2RawIO multiplies the int32 block numbers firstblock and succ_block by 512 and keeps the result in an int32 field. Version 9 files store disk offsets as 512-byte block numbers so they can grow to 1 TB (CED's Sonintl.h, the header #1944 cites):
https://github.com/ebtrexler/NETrex/blob/d864e988120afe94457073297eb89528434a2abf/legacy/SON/Sonintl.h#L66-L79

So for a block past 2 GiB parse_header() throws an OSError with NumPy 2, and with NumPy 1.26 the signal is read from the wrong place without any error. This PR casts both block numbers with int() before multiplying and stores pos as int64. This is one more of the many NumPy integer overflows we have run into (#1642, #1669 and #1690 in Blackrock, and #1929 for .nev files over 4 GiB).

@h-mayorquin
h-mayorquin requested a review from zm711 November 6, 2026 17:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant