Avoid panic on truncated input by using bounds-checked slice in CLI#688
Merged
ChristopherRabotin merged 2 commits intonyx-space:masterfrom Apr 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request improves error handling in anise-cli/src/main.rs by replacing direct slice indexing with safe access and converting some .unwrap() calls to proper error propagation. The review feedback correctly identifies remaining .unwrap() calls that should be replaced with the ? operator to ensure the application handles malformed input gracefully without panicking.
Member
|
Could you apply the attached patch. I can't push to your branch. Thanks |
647ec5e to
8531332
Compare
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
8531332 to
4cdd039
Compare
Contributor
Author
|
I’ve applied the changes to the branch. Please let me know if anything else needs adjustment. |
Member
|
Great, thank you! |
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
This PR improves the robustness of the CLI by removing panic paths when handling user-provided input files.
Architectural Changes
None.
New Features
None.
Improvements
&bytes[..SIZE]) with bounds-checked access using.get(..SIZE).unwrap()inconvert_fkflow with proper error propagation using.context(...)Bug Fixes
FileRecord::SIZEconvert_fkpath by replacing.unwrap()with error propagationTesting and Validation
Documentation
No documentation changes.
Notes