diff --git a/src/de.rs b/src/de.rs index fd7e84e..72aa340 100644 --- a/src/de.rs +++ b/src/de.rs @@ -25,7 +25,7 @@ impl<'a, T: DeserializeParams<'a>> Uri<'a, bitcoin::address::NetworkUnchecked, T return Err(Error::Uri(UriError(UriErrorInner::TooShort))); } - if !string[..SCHEME.len()].eq_ignore_ascii_case(SCHEME) { + if !string.get(..SCHEME.len()).is_some_and(|s| s.eq_ignore_ascii_case(SCHEME)) { return Err(Error::Uri(UriError(UriErrorInner::InvalidScheme))); } diff --git a/src/lib.rs b/src/lib.rs index b149115..73376c6 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -427,4 +427,11 @@ mod tests { assert!(uri.label.is_none()); assert!(uri.message.is_none()); } + + #[test] + fn bad_unicode_scheme() { + let input = "bitcoinö:1andreas3batLhQa2FawWjeyjCqyBzypd"; + let uri = input.parse::>(); + assert!(uri.is_err()); + } }