1
Fork 0

Fix wrong deref

This commit is contained in:
lzutao 2020-03-16 23:54:32 +07:00 committed by GitHub
parent ce5e49f86f
commit e1bc9af9eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -600,7 +600,7 @@ impl Wtf8 {
#[inline]
fn final_lead_surrogate(&self) -> Option<u16> {
match self.bytes {
[.., 0xED, b2 @ 0xA0..=0xAF, b3] => Some(decode_surrogate(*b2, *b3)),
[.., 0xED, b2 @ 0xA0..=0xAF, b3] => Some(decode_surrogate(b2, b3)),
_ => None,
}
}
@ -608,7 +608,7 @@ impl Wtf8 {
#[inline]
fn initial_trail_surrogate(&self) -> Option<u16> {
match self.bytes {
[0xED, b2 @ 0xB0..=0xBF, b3, ..] => Some(decode_surrogate(*b2, *b3)),
[0xED, b2 @ 0xB0..=0xBF, b3, ..] => Some(decode_surrogate(b2, b3)),
_ => None,
}
}