Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in header parsing when trace count is parsing block_size + 1 #477

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

tasansal
Copy link
Collaborator

@tasansal tasansal commented Dec 6, 2024

Problem

There was an edge case when the trace count was 1 more than the N*block_size for parsing the grid headers; this caused a singleton array to return.

E.g. if the block size is 100 and we have 201 traces, blocks:

  1. [0, 100) = array size 100
  2. [100, 200) = array size 100
  3. [200, 201) = array size 1 (singleton)

In the third block, this caused unexpected indexing and subsequent concatenation errors due to us manipulating a singleton array with slicing semantics.

Solution

Ensure the new filtered array is at least 1d by using ndmin=1 in array constructor.

@tasansal tasansal added the bug Something isn't working label Dec 6, 2024
@tasansal tasansal self-assigned this Dec 6, 2024
@tasansal tasansal changed the title Fix header parsing error when trace count is block_size + 1 Fix crash in header parsing when trace count is parsing block_size + 1 Dec 6, 2024
@tasansal tasansal merged commit 3d5cfe2 into main Dec 6, 2024
19 checks passed
@tasansal tasansal deleted the segy-header-parse-singleton-slice branch December 6, 2024 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant