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:
Henri Sivonen
2017-04-28 10:01:04 +03:00
parent 6dd118cad4
commit d894e27dfa
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -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
+6
View File
@@ -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);
}
}
}
}