mirror of
https://github.com/openharmony/third_party_rust_encoding_rs.git
synced 2026-07-21 02:05:23 -04:00
Fix subslicing with bad indices in Encoder::encode_from_utf16.
Due to an oversight, it lacked the fix that `Encoder::encode_from_utf8` already had.
This commit is contained in:
@@ -96,6 +96,13 @@ encoding_rs is
|
||||
|
||||
## Release Notes
|
||||
|
||||
### 0.6.2
|
||||
|
||||
* Fix a panic from subslicing with bad indices in
|
||||
`Encoder::encode_from_utf16`. (Due to an oversight, it lacked the fix that
|
||||
`Encoder::encode_from_utf8` already had.)
|
||||
* Micro-optimize error status accumulation in non-streaming case.
|
||||
|
||||
### 0.6.1
|
||||
|
||||
* Avoid panic near integer overflow in a case that's unlikely to actually
|
||||
|
||||
@@ -3718,6 +3718,12 @@ impl Encoder {
|
||||
// ASCII or the Roman state. We are allowed to generate any
|
||||
// printable ASCII excluding \ and ~.
|
||||
total_written += write_ncr(unmappable, &mut dst[total_written..]);
|
||||
if total_written >= effective_dst_len {
|
||||
return (CoderResult::OutputFull,
|
||||
total_read,
|
||||
total_written,
|
||||
had_unmappables);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user