[GH-ISSUE #1843] Zone parses panic when parsing a zone that contains a hostname with a leading whitespace #790

Closed
opened 2026-03-16 00:14:38 +03:00 by kerem · 2 comments
Owner

Originally created by @wuerges on GitHub (Nov 28, 2022).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1843

Describe the bug
Zone parses panic when parsing a zone that contains a hostname with a leading whitespace, instead of resulting in an Err.

To Reproduce
This PR contains a test that shows the bug:
https://github.com/bluejekyll/trust-dns/pull/1842

Expected behavior
When parsing an invalid zone, we expected an Err, but instead trust-dns panics:

---- serialize::txt::zone::tests::test_zone_parse stdout ----
thread 'serialize::txt::zone::tests::test_zone_parse' panicked at 'assertion failed: str.chars().all(|x| char::is_ascii_uppercase(&x))', crates/proto/src/rr/dns_class.rs:56:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

System:

  • OS: macOs
  • Architecture: intel
  • Version: main
  • rustc version: 1.65.0

Version:
Crate: client
Version: main

Additional context
Add any other context about the problem here.

Originally created by @wuerges on GitHub (Nov 28, 2022). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1843 **Describe the bug** Zone parses panic when parsing a zone that contains a hostname with a leading whitespace, instead of resulting in an `Err`. **To Reproduce** This PR contains a test that shows the bug: https://github.com/bluejekyll/trust-dns/pull/1842 **Expected behavior** When parsing an invalid zone, we expected an `Err`, but instead trust-dns panics: ``` ---- serialize::txt::zone::tests::test_zone_parse stdout ---- thread 'serialize::txt::zone::tests::test_zone_parse' panicked at 'assertion failed: str.chars().all(|x| char::is_ascii_uppercase(&x))', crates/proto/src/rr/dns_class.rs:56:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` **System:** - OS: macOs - Architecture: intel - Version: main - rustc version: 1.65.0 **Version:** Crate: client Version: main **Additional context** Add any other context about the problem here.
kerem closed this issue 2026-03-16 00:14:43 +03:00
Author
Owner

@wuerges commented on GitHub (Dec 9, 2022):

As @darnuria pointed out, the issue only happens in the test configuration.
However, even so, the PR makes a small tweak to the debug_assert that caused the panic so this panic is much more unlikely.

<!-- gh-comment-id:1344689539 --> @wuerges commented on GitHub (Dec 9, 2022): As @darnuria pointed out, the issue only happens in the `test` configuration. However, even so, the PR makes a small tweak to the `debug_assert` that caused the panic so this panic is much more unlikely.
Author
Owner

@bluejekyll commented on GitHub (Jan 3, 2023):

I believe this is resolved now in #1842

<!-- gh-comment-id:1370229602 --> @bluejekyll commented on GitHub (Jan 3, 2023): I believe this is resolved now in #1842
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#790
No description provided.