Skip to content

Allow non-UTF-8 strings in event names and ACL categories - #475

Merged
memark merged 3 commits into
masterfrom
memark-lossy
Jul 15, 2026
Merged

Allow non-UTF-8 strings in event names and ACL categories#475
memark merged 3 commits into
masterfrom
memark-lossy

Conversation

@memark

@memark memark commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Two places in macros.rs called CStr::to_str().unwrap() which would panic for invalid UTF-8. Changed both places to call CStr::to_string_lossy() instead.

NB: For invalid UTF-8 this call will allocate memory.

Solves #472.

@memark memark changed the title call to_string_lossy() instead of to_str() in macros Fix panic on non-UTF-8 event names Jul 14, 2026
Comment thread src/macros.rs
Comment thread src/macros.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add a test with invalid UTF-8?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test for an invalid UTF-8 event name.

The ACL category currently cannot be invalid UTF-8 (but I still think the change is reasonable), so no test for that.

@memark memark changed the title Fix panic on non-UTF-8 event names Fix panic on non-UTF-8 event names and ACL categories Jul 15, 2026
@memark memark changed the title Fix panic on non-UTF-8 event names and ACL categories Allow non-UTF-8 strings in event names and ACL categories Jul 15, 2026
Comment thread examples/events.rs
oshadmi
oshadmi previously approved these changes Jul 15, 2026
@memark
memark merged commit 591e7db into master Jul 15, 2026
8 checks passed
@memark
memark deleted the memark-lossy branch July 15, 2026 13:51
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