Skip to content

[core][view] Add offset or contiguous guards for all get and set methods#319

Merged
shivasankarka merged 2 commits into
pre-0.9from
safe
Feb 23, 2026
Merged

[core][view] Add offset or contiguous guards for all get and set methods#319
shivasankarka merged 2 commits into
pre-0.9from
safe

Conversation

@forfudan
Copy link
Copy Markdown
Collaborator

This PR is related to Issue #309 (Phase 4) for view safety. It brings offset-aware core getters/setters.

Problem is that aroudn 30 locations in ndarray.mojo, we accessed self._buf.ptr[i] directly without adding self.offset, causing data corruption on views that share a buffer with non-zero offset.

Fixes are applied to core get dunders, set dunders, store method, load method, etc.

Add new tests covering load/store, item/itemset, getitem/setitem with Item/Int/mask/slices on offset views. All tests pass across the full suite.

@shivasankarka shivasankarka merged commit ed68945 into pre-0.9 Feb 23, 2026
2 checks passed
@forfudan forfudan deleted the safe branch February 23, 2026 08:18
forfudan added a commit that referenced this pull request Mar 31, 2026
…methods (#319)

This PR is related to Issue #309 (Phase 4) for view safety. It brings
offset-aware core getters/setters.

Problem is that aroudn 30 locations in ndarray.mojo, we accessed
`self._buf.ptr[i]` directly without adding `self.offset`, causing data
corruption on views that share a buffer with non-zero offset.

Fixes are applied to core get dunders, set dunders, store method, load
method, etc.

Add new tests covering load/store, item/itemset, __getitem__/__setitem__
with Item/Int/mask/slices on offset views. All tests pass across the
full suite.
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.

2 participants