Skip to content

Conversation

@franciszekjob
Copy link
Contributor

@franciszekjob franciszekjob commented Dec 17, 2025

Closes #3983

Introduced changes

Add escaping for non-printable ASCII

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@franciszekjob franciszekjob requested a review from a team as a code owner December 17, 2025 15:17
@franciszekjob franciszekjob marked this pull request as draft December 17, 2025 15:27
@franciszekjob franciszekjob marked this pull request as ready for review December 17, 2025 17:18
Copy link

Copilot AI left a 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 ToShortString trait in favor of direct byte manipulation
  • Added comprehensive test coverage using test-case for 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.

@franciszekjob franciszekjob marked this pull request as draft December 22, 2025 10:08
@franciszekjob franciszekjob marked this pull request as ready for review December 22, 2025 10:19
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.

Fuzzed ByteArrays that contain non-printable ascii bytes cause rust to panic

3 participants