Skip to content

Fix byte offsets of row oriented array components and out-of-record reads in get_channel_raw_bytes - #1319

Merged
danielhrisca merged 1 commit into
danielhrisca:developmentfrom
victorjoh:fix-array-element-offsets
Oct 1, 2026
Merged

danielhrisca merged 1 commit into
danielhrisca:developmentfrom
victorjoh:fix-array-element-offsets

Conversation

@victorjoh

Copy link
Copy Markdown
Contributor

Fixes #1318. Related: #1264, #1316.

  • ChannelArrayBlock._factors: for row-oriented layout the last dimension now varies fastest, so f(d) = f(d+1)·dim_size(d+1). Column-oriented (FLAG_CA_INVERSE_LAYOUT) results are unchanged.
  • get_channel_raw_bytes / get_channel_raw_bytes_C: clamp the number of bytes read to the part of the channel inside the record, and zero-fill the rest. Before this, a channel starting at or after the end of the record wrote past the output buffer.

Tests:

  • test_mdf4.py::test_row_oriented_array_components: writes a 7 × 6 matrix and checks that all element channels are inside the record and have the right values.
  • test_cutils.py: get_channel_raw_bytes with channels inside, partly outside and fully outside the record. The last case only fails reliably under PYTHONMALLOC=debug.

Both new tests fail on development and pass with this change.

@danielhrisca

Copy link
Copy Markdown
Owner

thanks @victorjoh

@danielhrisca
danielhrisca merged commit f06d6c5 into danielhrisca:development Oct 1, 2026
15 of 22 checks passed
@derdabi

derdabi commented Oct 2, 2026

Copy link
Copy Markdown

Thanks for merging this. Is there a planned release that will include the fix, e.g. the next release from development? Since there are other fixes there as well, we'd like to know roughly when to expect it. If that's still some way off, a backport to asammdf_8.8.x (8.8.28) would also help us, as we're on 8.8.27 and affected by the wrong byte offsets of row-oriented array components.

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.

3 participants