diff --git a/README.md b/README.md index 529a333..7498ee7 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/lib.rs b/src/lib.rs index 4f26ae9..977f94d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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); + } } } }