File tree 1 file changed +5
-4
lines changed
portable/src/implementation
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -69,16 +69,17 @@ impl Utf8ValidatorImp {
69
69
return ;
70
70
}
71
71
} ;
72
- let rem_input = input. len ( ) - e. valid_up_to ( ) - 1 ;
73
- for i in 0 ..rem_input. min ( self . expected_cont_bytes as usize ) {
74
- if input[ e. valid_up_to ( ) + i + 1 ] & 0b1100_0000 != 0b1000_0000 {
72
+ let rem_input = & input[ e. valid_up_to ( ) + 1 ..] ;
73
+ let rem_input = & rem_input[ 0 ..rem_input. len ( ) . min ( self . expected_cont_bytes as usize ) ] ;
74
+ for b in rem_input {
75
+ if b & 0b1100_0000 != 0b1000_0000 {
75
76
// not a continuation byte
76
77
self . err = true ;
77
78
return ;
78
79
}
79
80
self . expected_cont_bytes -= 1 ;
80
81
}
81
- debug_assert ! ( self . expected_cont_bytes != 0 ) ; // otherwise from_utf8 would not have errored
82
+ debug_assert ! ( self . expected_cont_bytes > 0 ) ; // otherwise from_utf8 would not have errored
82
83
}
83
84
}
84
85
You can’t perform that action at this time.
0 commit comments