Skip to content

fix(dogstatsd): handle non-UTF-8 packets gracefully instead of panicking#79

Merged
duncanista merged 2 commits intomainfrom
jordan.gonzalez/dogstatsd/fix-utf8-panic-on-malformed-packets
Feb 19, 2026
Merged

fix(dogstatsd): handle non-UTF-8 packets gracefully instead of panicking#79
duncanista merged 2 commits intomainfrom
jordan.gonzalez/dogstatsd/fix-utf8-panic-on-malformed-packets

Conversation

@duncanista
Copy link
Contributor

@duncanista duncanista commented Feb 19, 2026

What does this PR do?

Process_packet() used expect() on std::str::from_utf8(), which would panic if a client sent malformed (non-UTF-8) bytes over UDP. This replaces the panic with an error log and early return, dropping the invalid packet safely. Adds a unit test to verify the behavior.

Motivation

It would panic before

Describe how to test/QA your changes

Unit tests

duncanista and others added 2 commits February 18, 2026 20:01
process_packet() used expect() on std::str::from_utf8(), which would
panic if a client sent malformed (non-UTF-8) bytes over UDP. This
replaces the panic with an error log and early return, dropping the
invalid packet safely. Adds a unit test to verify the behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@duncanista duncanista marked this pull request as ready for review February 19, 2026 05:12
@duncanista duncanista requested review from a team as code owners February 19, 2026 05:12
@duncanista duncanista requested review from Lewis-E and shreyamalpani and removed request for a team February 19, 2026 05:12
@duncanista duncanista merged commit e580b43 into main Feb 19, 2026
26 checks passed
@duncanista duncanista deleted the jordan.gonzalez/dogstatsd/fix-utf8-panic-on-malformed-packets branch February 19, 2026 19:00
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.

3 participants