mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[PR #1842] [MERGED] FIX WIP: Zone Parser panics when hostname entry has a leading whitespace. #2649
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#2649
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/1842
Author: @wuerges
Created: 11/28/2022
Status: ✅ Merged
Merged: 12/21/2022
Merged by: @bluejekyll
Base:
main← Head:fix_zone_parse_panic📝 Commits (2)
34879c3add test to show parser panic562d61bfix panic on record types and dns class parse when type has symbols📊 Changes
3 files changed (+65 additions, -22 deletions)
View changed files
📝
crates/client/src/serialize/txt/zone.rs(+27 -0)📝
crates/proto/src/rr/dns_class.rs(+31 -21)📝
crates/proto/src/rr/record_type.rs(+7 -1)📄 Description
Context:
https://github.com/bluejekyll/trust-dns/issues/1843
Zone parses panic when parsing a zone that contains a hostname with a leading whitespace, instead of resulting in an Err, when running in
#cfg(debug).Expected behavior
When parsing an invalid zone, we expected an Err, but instead trust-dns panics:
Root cause:
The root cause of the error was a
debug_assertcall that assumed that after anto_ascii_uppercase, all characters turn into ascii uppercase letters.The
debug_assertfailed because of characters that are not letters, such as the-.When a line in the zone file starts with a whitespace, it does not represent a new hostname. It represents a record belonging to the previous line.
Therefore, the parser was not trying to parse the
faulty-record-typeas a hostname name.The parser correctly tried to parse the faulty hostname as a
DNSClassand then as aRecordType.However, since the
faulty-record-typecontained an-, it panicked.This PR:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.