-
Notifications
You must be signed in to change notification settings - Fork 247
Add escaping for non-printable in ByteArray
#4034
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
base: master
Are you sure you want to change the base?
Conversation
… into 3983-escape-non-printable-in-byte-array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds proper escaping for non-printable ASCII characters in the ByteArray Display implementation to prevent panics during fuzz testing. The previous implementation would panic when encountering null bytes or other non-printable characters.
Key changes:
- Refactored Display implementation to escape non-printable bytes as
\x{:02x}format while preserving common whitespace characters - Removed dependency on
ToShortStringtrait in favor of direct byte manipulation - Added comprehensive test coverage using
test-casefor various non-printable character scenarios
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crates/conversions/src/byte_array.rs |
Refactored Display implementation with byte-level escaping, added helper functions for byte extraction, replaced panic-prone test with comprehensive parameterized tests |
crates/conversions/Cargo.toml |
Added test-case as dev dependency for parameterized testing |
Cargo.lock |
Updated lock file to include test-case dependency |
CHANGELOG.md |
Documented the fix for byte array display with non-printable characters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… into 3983-escape-non-printable-in-byte-array
…hub.com/foundry-rs/starknet-foundry into 3983-escape-non-printable-in-byte-array
Closes #3983
Introduced changes
Add escaping for non-printable ASCII
Checklist
CHANGELOG.md