File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
portable/src/implementation Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -69,16 +69,17 @@ impl Utf8ValidatorImp {
6969 return ;
7070 }
7171 } ;
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 {
7576 // not a continuation byte
7677 self . err = true ;
7778 return ;
7879 }
7980 self . expected_cont_bytes -= 1 ;
8081 }
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
8283 }
8384 }
8485
You can’t perform that action at this time.
0 commit comments