Add data length validation for write_section and write_region#436
Open
simonrw wants to merge 1 commit intofix/axis-ordering-regionfrom
Open
Add data length validation for write_section and write_region#436simonrw wants to merge 1 commit intofix/axis-ordering-regionfrom
simonrw wants to merge 1 commit intofix/axis-ordering-regionfrom
Conversation
Replace assert! in write_section with an Err return when the data slice is too small for the requested range. Add equivalent validation to write_region which previously had none, risking out-of-bounds reads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
write_sectionusedassert!which panics on insufficient data — replaced withErrreturnwrite_regionhad no data length validation at all, risking out-of-bounds reads when the data slice was too small for the specified regionErrreturns with descriptive messages for bothStacked on #433
Test plan
write_sectionreturnsErrinstead of panicking on short datawrite_regionreturnsErron short data🤖 Generated with Claude Code