Bug 1509507 - Update to encoding_rs 0.8.13 to fix a panic in UTF-8 to UTF-16 decode. r=m_kato

Differential Revision: https://phabricator.services.mozilla.com/D13253

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henri Sivonen 2018-11-30 07:42:26 +00:00
Родитель da86564348
Коммит bfddcfb70e
6 изменённых файлов: 31 добавлений и 9 удалений

10
Cargo.lock сгенерированный
Просмотреть файл

@ -799,21 +799,21 @@ name = "encoding_c"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "encoding_glue"
version = "0.1.0"
dependencies = [
"encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)",
"nserror 0.1.0",
"nsstring 0.1.0",
]
[[package]]
name = "encoding_rs"
version = "0.8.12"
version = "0.8.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1704,7 +1704,7 @@ name = "nsstring"
version = "0.1.0"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -3198,7 +3198,7 @@ dependencies = [
"checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a"
"checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621"
"checksum encoding_c 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "769ecb8b33323998e482b218c0d13cd64c267609023b4b7ec3ee740714c318ee"
"checksum encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ca20350a7cb5aab5b9034731123d6d412caf3e92d4985e739e411ba0955fd0eb"
"checksum encoding_rs 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1a8fa54e6689eb2549c4efed8d00d7f3b2b994a064555b0e8df4ae3764bcc4be"
"checksum env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0561146661ae44c579e993456bc76d11ce1e0c7d745e57b2fa7146b6e49fa2ad"
"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
"checksum euclid 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)" = "600657e7e5c03bfbccdc68721bc3b5abcb761553973387124eae9c9e4f02c210"

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

2
third_party/rust/encoding_rs/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "encoding_rs"
version = "0.8.12"
version = "0.8.13"
authors = ["Henri Sivonen <hsivonen@hsivonen.fi>"]
description = "A Gecko-oriented implementation of the Encoding Standard"
homepage = "https://docs.rs/encoding_rs/"

6
third_party/rust/encoding_rs/README.md поставляемый
Просмотреть файл

@ -369,6 +369,12 @@ To regenerate the generated code:
## Release Notes
### 0.8.13
* Made the UTF-8 to UTF-16 compare the number of code units written with the
length of the right slice (the output slice) to fix a panic introduced in
0.8.11.
### 0.8.12
* Removed the `clippy::` prefix from clippy lint names.

2
third_party/rust/encoding_rs/src/lib.rs поставляемый
Просмотреть файл

@ -15,7 +15,7 @@
new_ret_no_self
)
)]
#![doc(html_root_url = "https://docs.rs/encoding_rs/0.8.12")]
#![doc(html_root_url = "https://docs.rs/encoding_rs/0.8.13")]
//! encoding_rs is a Gecko-oriented Free Software / Open Source implementation
//! of the [Encoding Standard](https://encoding.spec.whatwg.org/) in Rust.

18
third_party/rust/encoding_rs/src/utf_8.rs поставляемый
Просмотреть файл

@ -395,7 +395,7 @@ pub fn convert_utf8_to_utf16_up_to_invalid(src: &[u8], dst: &mut [u16]) -> (usiz
// one to three shorter sequences.
'tail: loop {
// >= is better for bound check elision than ==
if read >= src.len() || written >= src.len() {
if read >= src.len() || written >= dst.len() {
break 'outer;
}
byte = src[read];
@ -1101,4 +1101,20 @@ mod tests {
}
}
#[test]
fn test_tail() {
let mut output = [0u16; 1];
let mut decoder = UTF_8.new_decoder_without_bom_handling();
{
let (result, read, written, had_errors) =
decoder.decode_to_utf16("\u{E4}a".as_bytes(), &mut output[..], false);
assert_eq!(result, CoderResult::OutputFull);
assert_eq!(read, 2);
assert_eq!(written, 1);
assert!(!had_errors);
assert_eq!(output[0], 0x00E4);
}
}
}