From c82d099240009a269902e533c3fc1eed4e707a6f Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Thu, 9 Aug 2018 15:35:34 +0300 Subject: [PATCH] Bug 1482095 - Update encoding_rs to 0.8.6. r=emk. MozReview-Commit-ID: IqPrrQ7L1lU --- Cargo.lock | 10 +- .../rust/encoding_rs/.cargo-checksum.json | 2 +- third_party/rust/encoding_rs/Cargo.toml | 2 +- third_party/rust/encoding_rs/README.md | 23 ++ third_party/rust/encoding_rs/src/lib.rs | 9 +- third_party/rust/encoding_rs/src/mem.rs | 261 ++++++++++++++---- 6 files changed, 240 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 050144964a4c..49f256a2d5bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -634,21 +634,21 @@ name = "encoding_c" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "encoding_rs 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encoding_glue" version = "0.1.0" dependencies = [ - "encoding_rs 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)", "nserror 0.1.0", "nsstring 0.1.0", ] [[package]] name = "encoding_rs" -version = "0.8.4" +version = "0.8.6" 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)", @@ -1458,7 +1458,7 @@ name = "nsstring" version = "0.1.0" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding_rs 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2684,7 +2684,7 @@ dependencies = [ "checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a" "checksum ena 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe5a5078ac8c506d3e4430763b1ba9b609b1286913e7d08e581d1c2de9b7e5" "checksum encoding_c 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "769ecb8b33323998e482b218c0d13cd64c267609023b4b7ec3ee740714c318ee" -"checksum encoding_rs 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88a1b66a0d28af4b03a8c8278c6dcb90e6e600d89c14500a9e7a02e64b9ee3ac" +"checksum encoding_rs 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2a91912d6f37c6a8fef8a2316a862542d036f13c923ad518b5aca7bcaac7544c" "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.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70a2ebdf55fb9d6329046e026329a55ef8fbaae5ea833f56e170beb3125a8a5f" diff --git a/third_party/rust/encoding_rs/.cargo-checksum.json b/third_party/rust/encoding_rs/.cargo-checksum.json index 90a88e7b2c24..8e37cc0b7098 100644 --- a/third_party/rust/encoding_rs/.cargo-checksum.json +++ b/third_party/rust/encoding_rs/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".travis.yml":"262b9925451db996c31e4bb8bb6bbdb36c3f6009f407db5ed4b0ed25cd72d8c8","CONTRIBUTING.md":"0d4bfb1068c2b2f32b7bc7833662dfff628d86b0f31068266027c719fb727360","COPYRIGHT":"20d4fff11cca11529df3f02096fbe8ffe350219cdb07cdedea34e6a762866da5","Cargo.toml":"e950a52d578e21c59f56adb406310e7593e6126b9f02e5d376af7627691a7fd6","Ideas.md":"7fbeddb0f8ba7b233673ee705997adc2fddb1636a17fe662532b35ef2810a51d","LICENSE-APACHE":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","LICENSE-MIT":"74aa8b6d04c36bb640ee81187a3f24a2fa94e36d4c1d4f2ca164c3784ae87a83","README.md":"87aa2c116f2de0ec2c40e2d4aae01bd15e314e1c8f197ba1e671edd763bd236f","doc/Big5.txt":"f73a2edc5cb6c2d140ba6e07f4542e1c4a234950378acde1df93480f0ca0be0b","doc/EUC-JP.txt":"ee2818b907d0137f40a9ab9fd525fc700a44dbdddb6cf0c157a656566bae4bf1","doc/EUC-KR.txt":"71d9e2ccf3b124e8bdfb433c8cf2773fd878077038d0cec3c7237a50f4a78a30","doc/GBK.txt":"c1b522b5a799884e5001da661f42c5a8f4d0acb9ef1d74b206f22b5f65365606","doc/IBM866.txt":"a5a433e804d0f83af785015179fbc1d9b0eaf1f7960efcd04093e136b51fbd0e","doc/ISO-2022-JP.txt":"af86684f5a8f0e2868d7b2c292860140c3d2e5527530ca091f1b28198e8e2fe6","doc/ISO-8859-10.txt":"6d3949ad7c81ca176895101ed81a1db7df1060d64e262880b94bd31bb344ab4d","doc/ISO-8859-13.txt":"3951dd89cf93f7729148091683cf8511f4529388b7dc8dcd0d62eaed55be93fa","doc/ISO-8859-14.txt":"3d330784a0374fd255a38b47949675cc7168c800530534b0a01cac6edc623adc","doc/ISO-8859-15.txt":"24b1084aab5127a85aab99153f86e24694d0a3615f53b5ce23683f97cf66c47a","doc/ISO-8859-16.txt":"ce0272559b92ba76d7a7e476f6424ae4a5cc72e75b183611b08392e44add4d25","doc/ISO-8859-2.txt":"18ceff88c13d1b5ba455a3919b1e3de489045c4c3d2dd7e8527c125c75d54aad","doc/ISO-8859-3.txt":"21798404c68f4f5db59223362f24999da96968c0628427321fccce7d2849a130","doc/ISO-8859-4.txt":"d27f6520c6c5bfbcc19176b71d081cdb3bccde1622bb3e420d5680e812632d53","doc/ISO-8859-5.txt":"a10ec8d6ea7a78ad15da7275f6cb1a3365118527e28f9af6d0d5830501303f3a","doc/ISO-8859-6.txt":"ccda8a2efc96115336bdd77776637b9712425e44fbcf745353b9057fbef144e7","doc/ISO-8859-7.txt":"17900fa1f27a445958f0a77d7d9056be375a6bd7ee4492aa680c7c1500bab85e","doc/ISO-8859-8-I.txt":"8357555646d54265a9b9ffa3e68b08d132312f1561c60108ff9b8b1167b6ecf2","doc/ISO-8859-8.txt":"72cd6f3afb7b4a9c16a66a362473315770b7755d72c86c870e52fc3eba86c8af","doc/KOI8-R.txt":"839cf19a38da994488004ed7814b1f6151640156a9a2af02bf2efca745fb5966","doc/KOI8-U.txt":"0cc76624ed1f024183e2298b7e019957da2c70c8ca06e0fc4e6f353f50a5054f","doc/Shift_JIS.txt":"34c49141818cb9ddbcf59cc858f78a79be8ad148d563f26415108ae1f148443f","doc/UTF-16BE.txt":"e2e280d8acbaa6d2a6b3569d60e17500a285f2baa0df3363dd85537cd5a1ef8f","doc/UTF-16LE.txt":"70bdc170e3fc5298ba68f10125fb5eeb8b077036cc96bb4416c4de396f6d76c1","doc/UTF-8.txt":"ea7bae742e613010ced002cf4b601a737d2203fad65e115611451bc4428f548a","doc/gb18030.txt":"dc71378a8f07a2d8659f69ee81fb8791fef56ba86f124b429978285237bb4a7b","doc/macintosh.txt":"57491e53866711b4672d9b9ff35380b9dac9e0d8e3d6c20bdd6140603687c023","doc/replacement.txt":"4b6c3bbd7999d9d4108a281594bd02d13607e334a95465afff8c2c08d395f0e4","doc/windows-1250.txt":"61296bb6a21cdab602300d32ecfba434cb82de5ac3bc88d58710d2f125e28d39","doc/windows-1251.txt":"7deea1c61dea1485c8ff02db2c7d578db7a9aab63ab1cfd02ec04b515864689e","doc/windows-1252.txt":"933ef3bdddfce5ee132b9f1a1aa8b47423d2587bbe475b19028d0a6d38e180b6","doc/windows-1253.txt":"1a38748b88e99071a5c7b3d5456ead4caedeabab50d50d658be105bc113714de","doc/windows-1254.txt":"f8372f86c6f8d642563cd6ddc025260553292a39423df1683a98670bd7bf2b47","doc/windows-1255.txt":"4e5852494730054e2da258a74e1b9d780abbcdd8ce22ebc218ca2efe9e90493d","doc/windows-1256.txt":"c0879c5172abedead302a406e8f60d9cd9598694a0ffa4fd288ffe4fef7b8ea1","doc/windows-1257.txt":"c28a0c9f964fcb2b46d21f537c402446501a2800670481d6abf9fd9e9018d523","doc/windows-1258.txt":"5019ae4d61805c79aacbf17c93793342dbb098d65a1837783bc3e2c6d6a23602","doc/windows-874.txt":"4ef0e4501c5feba8b17aee1818602ed44b36ca8475db771ce2fc16d392cabecc","doc/x-mac-cyrillic.txt":"58be154d8a888ca3d484b83b44f749823ef339ab27f14d90ca9a856f5050a8bd","doc/x-user-defined.txt":"f9cd07c4321bf5cfb0be4bdddd251072999b04a6cf7a6f5bc63709a84e2c1ffc","generate-encoding-data.py":"bbe134cc013a17c32bd51e868a2ee4f2c3e2205e40afb9fc60f98fa9758961b8","rustfmt.toml":"85c1a3b4382fd89e991cbb81b70fb52780472edc064c963943cdaaa56e0a2030","src/ascii.rs":"a9cf02c992229952976761655c044be23675a278de1a6186d8baaf66879c4f4a","src/big5.rs":"659ddb66f82142468774715cd9ecdc8356005fec9d91e46d54ae2280a88adb4b","src/data.rs":"18793e23f98d9aba1ed2858c43b2103c9c05a8571429b2128510c68d05ba8cb6","src/euc_jp.rs":"b178172274af1a6be38d388e5a2468e7140e9facf63d2f679f4ed77c3fc20a92","src/euc_kr.rs":"e27bd9c4e2172bb02004dd2a1fcbe02118415a1aec6a90b5632c9eac6f12ba7d","src/gb18030.rs":"752869f47ad0cad02ad3ccb6fde3eb277fa528e10e3d9432a90563db610d9dc2","src/handles.rs":"0598439bf66bd26699cba7e9e2fec001f8c57f3a510578fc3cc118ddc36d6831","src/iso_2022_jp.rs":"d904a92d49fc5878e6cb82a21185051c801489cf2800db8f37269965ca7974cc","src/lib.rs":"0a8842821e507665d9ff883b5f77c28cc45bdfcf58eab2edad03437e70a1ca7b","src/macros.rs":"04b3d81f1701b746dcce466ad2c3202a0a3e9c00f1d8db336276660640a12d7b","src/mem.rs":"b408367cef7ba93e9e90ec16cc62f763da58bcdbdb1ec0a856c6651e059ffead","src/replacement.rs":"61e0ae52664b3856f1ed202af6266b441ffcf5e2c9b22976047540e4a3252b41","src/shift_jis.rs":"7106d0a9785425b5af2323f3046e6130bd5125effa4ab484d84b529914855d67","src/simd_funcs.rs":"6139e2c7eebd8f3f35b8ce70891c6731595e5d18fa48b11f04f88c6342335935","src/single_byte.rs":"986571bb52f2cf7779c1dc8bdd8058c3183524a512bc2fcca6637eeee394b573","src/test_data/big5_in.txt":"4c5a8691f8dc717311889c63894026d2fb62725a86c4208ca274a9cc8d42a503","src/test_data/big5_in_ref.txt":"99d399e17750cf9c7cf30bb253dbfe35b81c4fcbdead93cfa48b1429213473c7","src/test_data/big5_out.txt":"6193ca97c297aa20e09396038d18e938bb7ea331c26f0f2454097296723a0b13","src/test_data/big5_out_ref.txt":"36567691f557df144f6cc520015a87038dfa156f296fcf103b56ae9a718be1fc","src/test_data/euc_kr_in.txt":"c86a7224f3215fa0d04e685622a752fdc72763e8ae076230c7fd62de57ec4074","src/test_data/euc_kr_in_ref.txt":"1f419f4ca47d708b54c73c461545a022ae2e20498fdbf8005a483d752a204883","src/test_data/euc_kr_out.txt":"e7f32e026f70be1e1b58e0047baf7d3d2c520269c4f9b9992e158b4decb0a1a3","src/test_data/euc_kr_out_ref.txt":"c9907857980b20b8e9e3b584482ed6567a2be6185d72237b6322f0404944924e","src/test_data/gb18030_in.txt":"ab7231b2d3e9afacdbd7d7f3b9e5361a7ff9f7e1cfdb4f3bd905b9362b309e53","src/test_data/gb18030_in_ref.txt":"dc5069421adca2043c55f5012b55a76fdff651d22e6e699fd0978f8d5706815c","src/test_data/gb18030_out.txt":"f0208d527f5ca63de7d9a0323be8d5cf12d8a104b2943d92c2701f0c3364dac1","src/test_data/gb18030_out_ref.txt":"6819fe47627e4ea01027003fc514b9f21a1322e732d7f1fb92cc6c5455bc6c07","src/test_data/iso_2022_jp_in.txt":"cd24bbdcb1834e25db54646fbf4c41560a13dc7540f6be3dba4f5d97d44513af","src/test_data/iso_2022_jp_in_ref.txt":"3dc4e6a5e06471942d086b16c9440945e78415f6f3f47e43717e4bc2eac2cdf5","src/test_data/iso_2022_jp_out.txt":"9b6f015329dda6c3f9ee5ce6dbd6fa9c89acc21283e886836c78b8d833480c21","src/test_data/iso_2022_jp_out_ref.txt":"78cb260093a20116ad9a42f43b05d1848c5ab100b6b9a850749809e943884b35","src/test_data/jis0208_in.txt":"6df3030553ffb0a6615bb33dc8ea9dca6d9623a9028e2ffec754ce3c3da824cc","src/test_data/jis0208_in_ref.txt":"3dc4e6a5e06471942d086b16c9440945e78415f6f3f47e43717e4bc2eac2cdf5","src/test_data/jis0208_out.txt":"4ec24477e1675ce750733bdc3c5add1cd27b6bd4ce1f09289564646e9654e857","src/test_data/jis0208_out_ref.txt":"c3e1cef5032b2b1d93a406f31ff940c4e2dfe8859b8b17ca2761fee7a75a0e48","src/test_data/jis0212_in.txt":"c011f0dd72bd7c8cd922df9374ef8d2769a77190514c77f6c62b415852eeb9fe","src/test_data/jis0212_in_ref.txt":"7d9458b3d2f73e7092a7f505c08ce1d233dde18aa679fbcf9889256239cc9e06","src/test_data/shift_jis_in.txt":"02e389ccef0dd2122e63f503899402cb7f797912c2444cc80ab93131116c5524","src/test_data/shift_jis_in_ref.txt":"512f985950ca902e643c88682dba9708b7c38d3c5ec2925168ab00ac94ab19f9","src/test_data/shift_jis_out.txt":"5fbc44da7bf639bf6cfe0fa1fd3eba7102b88f81919c9ea991302712f69426fb","src/test_data/shift_jis_out_ref.txt":"466322c6fed8286c64582731755290c2296508efdd258826e6279686649b481f","src/test_labels_names.rs":"c962c7aeac3d9ef2aca70c9e21983b231d4cf998cb06879374b0401e5149d1da","src/testing.rs":"b299d27055f3b068de66cc10a75c024b881c48bc093627c01e0b1f8bd7d94666","src/utf_16.rs":"32b6ecc3696542fb269a93c915e7402dde545e793f9599cf7dc63688fa226e0d","src/utf_8.rs":"5d16295faf1707b2058629eb2467200b86b02acfceda27433ac1d05ac385f9f3","src/utf_8_core.rs":"fe218284dbb9111a2336ff1684d7f58b55d9c4fe7363089a29e57f52901f0707","src/variant.rs":"e2c988a645429fd7457d7fbc487b838ab7ec7bfb8943d192992f18bbac8973f0","src/x_user_defined.rs":"1d25920ec5d005cbd623f34473d68991521aa3a83e52d4eb9b645711f10cd484"},"package":"88a1b66a0d28af4b03a8c8278c6dcb90e6e600d89c14500a9e7a02e64b9ee3ac"} \ No newline at end of file +{"files":{".travis.yml":"262b9925451db996c31e4bb8bb6bbdb36c3f6009f407db5ed4b0ed25cd72d8c8","CONTRIBUTING.md":"0d4bfb1068c2b2f32b7bc7833662dfff628d86b0f31068266027c719fb727360","COPYRIGHT":"20d4fff11cca11529df3f02096fbe8ffe350219cdb07cdedea34e6a762866da5","Cargo.toml":"08cdae00640c253eedbbff1fc100d959e5c65f43968831c6c74b0aee62305f89","Ideas.md":"7fbeddb0f8ba7b233673ee705997adc2fddb1636a17fe662532b35ef2810a51d","LICENSE-APACHE":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","LICENSE-MIT":"74aa8b6d04c36bb640ee81187a3f24a2fa94e36d4c1d4f2ca164c3784ae87a83","README.md":"c5e1b4ce1d693d0f4c58b87eb21721e79412c34cf60010e1a7b31876b410ea66","doc/Big5.txt":"f73a2edc5cb6c2d140ba6e07f4542e1c4a234950378acde1df93480f0ca0be0b","doc/EUC-JP.txt":"ee2818b907d0137f40a9ab9fd525fc700a44dbdddb6cf0c157a656566bae4bf1","doc/EUC-KR.txt":"71d9e2ccf3b124e8bdfb433c8cf2773fd878077038d0cec3c7237a50f4a78a30","doc/GBK.txt":"c1b522b5a799884e5001da661f42c5a8f4d0acb9ef1d74b206f22b5f65365606","doc/IBM866.txt":"a5a433e804d0f83af785015179fbc1d9b0eaf1f7960efcd04093e136b51fbd0e","doc/ISO-2022-JP.txt":"af86684f5a8f0e2868d7b2c292860140c3d2e5527530ca091f1b28198e8e2fe6","doc/ISO-8859-10.txt":"6d3949ad7c81ca176895101ed81a1db7df1060d64e262880b94bd31bb344ab4d","doc/ISO-8859-13.txt":"3951dd89cf93f7729148091683cf8511f4529388b7dc8dcd0d62eaed55be93fa","doc/ISO-8859-14.txt":"3d330784a0374fd255a38b47949675cc7168c800530534b0a01cac6edc623adc","doc/ISO-8859-15.txt":"24b1084aab5127a85aab99153f86e24694d0a3615f53b5ce23683f97cf66c47a","doc/ISO-8859-16.txt":"ce0272559b92ba76d7a7e476f6424ae4a5cc72e75b183611b08392e44add4d25","doc/ISO-8859-2.txt":"18ceff88c13d1b5ba455a3919b1e3de489045c4c3d2dd7e8527c125c75d54aad","doc/ISO-8859-3.txt":"21798404c68f4f5db59223362f24999da96968c0628427321fccce7d2849a130","doc/ISO-8859-4.txt":"d27f6520c6c5bfbcc19176b71d081cdb3bccde1622bb3e420d5680e812632d53","doc/ISO-8859-5.txt":"a10ec8d6ea7a78ad15da7275f6cb1a3365118527e28f9af6d0d5830501303f3a","doc/ISO-8859-6.txt":"ccda8a2efc96115336bdd77776637b9712425e44fbcf745353b9057fbef144e7","doc/ISO-8859-7.txt":"17900fa1f27a445958f0a77d7d9056be375a6bd7ee4492aa680c7c1500bab85e","doc/ISO-8859-8-I.txt":"8357555646d54265a9b9ffa3e68b08d132312f1561c60108ff9b8b1167b6ecf2","doc/ISO-8859-8.txt":"72cd6f3afb7b4a9c16a66a362473315770b7755d72c86c870e52fc3eba86c8af","doc/KOI8-R.txt":"839cf19a38da994488004ed7814b1f6151640156a9a2af02bf2efca745fb5966","doc/KOI8-U.txt":"0cc76624ed1f024183e2298b7e019957da2c70c8ca06e0fc4e6f353f50a5054f","doc/Shift_JIS.txt":"34c49141818cb9ddbcf59cc858f78a79be8ad148d563f26415108ae1f148443f","doc/UTF-16BE.txt":"e2e280d8acbaa6d2a6b3569d60e17500a285f2baa0df3363dd85537cd5a1ef8f","doc/UTF-16LE.txt":"70bdc170e3fc5298ba68f10125fb5eeb8b077036cc96bb4416c4de396f6d76c1","doc/UTF-8.txt":"ea7bae742e613010ced002cf4b601a737d2203fad65e115611451bc4428f548a","doc/gb18030.txt":"dc71378a8f07a2d8659f69ee81fb8791fef56ba86f124b429978285237bb4a7b","doc/macintosh.txt":"57491e53866711b4672d9b9ff35380b9dac9e0d8e3d6c20bdd6140603687c023","doc/replacement.txt":"4b6c3bbd7999d9d4108a281594bd02d13607e334a95465afff8c2c08d395f0e4","doc/windows-1250.txt":"61296bb6a21cdab602300d32ecfba434cb82de5ac3bc88d58710d2f125e28d39","doc/windows-1251.txt":"7deea1c61dea1485c8ff02db2c7d578db7a9aab63ab1cfd02ec04b515864689e","doc/windows-1252.txt":"933ef3bdddfce5ee132b9f1a1aa8b47423d2587bbe475b19028d0a6d38e180b6","doc/windows-1253.txt":"1a38748b88e99071a5c7b3d5456ead4caedeabab50d50d658be105bc113714de","doc/windows-1254.txt":"f8372f86c6f8d642563cd6ddc025260553292a39423df1683a98670bd7bf2b47","doc/windows-1255.txt":"4e5852494730054e2da258a74e1b9d780abbcdd8ce22ebc218ca2efe9e90493d","doc/windows-1256.txt":"c0879c5172abedead302a406e8f60d9cd9598694a0ffa4fd288ffe4fef7b8ea1","doc/windows-1257.txt":"c28a0c9f964fcb2b46d21f537c402446501a2800670481d6abf9fd9e9018d523","doc/windows-1258.txt":"5019ae4d61805c79aacbf17c93793342dbb098d65a1837783bc3e2c6d6a23602","doc/windows-874.txt":"4ef0e4501c5feba8b17aee1818602ed44b36ca8475db771ce2fc16d392cabecc","doc/x-mac-cyrillic.txt":"58be154d8a888ca3d484b83b44f749823ef339ab27f14d90ca9a856f5050a8bd","doc/x-user-defined.txt":"f9cd07c4321bf5cfb0be4bdddd251072999b04a6cf7a6f5bc63709a84e2c1ffc","generate-encoding-data.py":"bbe134cc013a17c32bd51e868a2ee4f2c3e2205e40afb9fc60f98fa9758961b8","rustfmt.toml":"85c1a3b4382fd89e991cbb81b70fb52780472edc064c963943cdaaa56e0a2030","src/ascii.rs":"a9cf02c992229952976761655c044be23675a278de1a6186d8baaf66879c4f4a","src/big5.rs":"659ddb66f82142468774715cd9ecdc8356005fec9d91e46d54ae2280a88adb4b","src/data.rs":"18793e23f98d9aba1ed2858c43b2103c9c05a8571429b2128510c68d05ba8cb6","src/euc_jp.rs":"b178172274af1a6be38d388e5a2468e7140e9facf63d2f679f4ed77c3fc20a92","src/euc_kr.rs":"e27bd9c4e2172bb02004dd2a1fcbe02118415a1aec6a90b5632c9eac6f12ba7d","src/gb18030.rs":"752869f47ad0cad02ad3ccb6fde3eb277fa528e10e3d9432a90563db610d9dc2","src/handles.rs":"0598439bf66bd26699cba7e9e2fec001f8c57f3a510578fc3cc118ddc36d6831","src/iso_2022_jp.rs":"d904a92d49fc5878e6cb82a21185051c801489cf2800db8f37269965ca7974cc","src/lib.rs":"3d5aadf041a7876997fd724a9edfc6f770bca62c6c11c345048a17a90d04d384","src/macros.rs":"04b3d81f1701b746dcce466ad2c3202a0a3e9c00f1d8db336276660640a12d7b","src/mem.rs":"097a05f8f6a6adfd079ff53b6cddeac7447bb63d1aaffb1cf13c2a97f5c124fe","src/replacement.rs":"61e0ae52664b3856f1ed202af6266b441ffcf5e2c9b22976047540e4a3252b41","src/shift_jis.rs":"7106d0a9785425b5af2323f3046e6130bd5125effa4ab484d84b529914855d67","src/simd_funcs.rs":"6139e2c7eebd8f3f35b8ce70891c6731595e5d18fa48b11f04f88c6342335935","src/single_byte.rs":"986571bb52f2cf7779c1dc8bdd8058c3183524a512bc2fcca6637eeee394b573","src/test_data/big5_in.txt":"4c5a8691f8dc717311889c63894026d2fb62725a86c4208ca274a9cc8d42a503","src/test_data/big5_in_ref.txt":"99d399e17750cf9c7cf30bb253dbfe35b81c4fcbdead93cfa48b1429213473c7","src/test_data/big5_out.txt":"6193ca97c297aa20e09396038d18e938bb7ea331c26f0f2454097296723a0b13","src/test_data/big5_out_ref.txt":"36567691f557df144f6cc520015a87038dfa156f296fcf103b56ae9a718be1fc","src/test_data/euc_kr_in.txt":"c86a7224f3215fa0d04e685622a752fdc72763e8ae076230c7fd62de57ec4074","src/test_data/euc_kr_in_ref.txt":"1f419f4ca47d708b54c73c461545a022ae2e20498fdbf8005a483d752a204883","src/test_data/euc_kr_out.txt":"e7f32e026f70be1e1b58e0047baf7d3d2c520269c4f9b9992e158b4decb0a1a3","src/test_data/euc_kr_out_ref.txt":"c9907857980b20b8e9e3b584482ed6567a2be6185d72237b6322f0404944924e","src/test_data/gb18030_in.txt":"ab7231b2d3e9afacdbd7d7f3b9e5361a7ff9f7e1cfdb4f3bd905b9362b309e53","src/test_data/gb18030_in_ref.txt":"dc5069421adca2043c55f5012b55a76fdff651d22e6e699fd0978f8d5706815c","src/test_data/gb18030_out.txt":"f0208d527f5ca63de7d9a0323be8d5cf12d8a104b2943d92c2701f0c3364dac1","src/test_data/gb18030_out_ref.txt":"6819fe47627e4ea01027003fc514b9f21a1322e732d7f1fb92cc6c5455bc6c07","src/test_data/iso_2022_jp_in.txt":"cd24bbdcb1834e25db54646fbf4c41560a13dc7540f6be3dba4f5d97d44513af","src/test_data/iso_2022_jp_in_ref.txt":"3dc4e6a5e06471942d086b16c9440945e78415f6f3f47e43717e4bc2eac2cdf5","src/test_data/iso_2022_jp_out.txt":"9b6f015329dda6c3f9ee5ce6dbd6fa9c89acc21283e886836c78b8d833480c21","src/test_data/iso_2022_jp_out_ref.txt":"78cb260093a20116ad9a42f43b05d1848c5ab100b6b9a850749809e943884b35","src/test_data/jis0208_in.txt":"6df3030553ffb0a6615bb33dc8ea9dca6d9623a9028e2ffec754ce3c3da824cc","src/test_data/jis0208_in_ref.txt":"3dc4e6a5e06471942d086b16c9440945e78415f6f3f47e43717e4bc2eac2cdf5","src/test_data/jis0208_out.txt":"4ec24477e1675ce750733bdc3c5add1cd27b6bd4ce1f09289564646e9654e857","src/test_data/jis0208_out_ref.txt":"c3e1cef5032b2b1d93a406f31ff940c4e2dfe8859b8b17ca2761fee7a75a0e48","src/test_data/jis0212_in.txt":"c011f0dd72bd7c8cd922df9374ef8d2769a77190514c77f6c62b415852eeb9fe","src/test_data/jis0212_in_ref.txt":"7d9458b3d2f73e7092a7f505c08ce1d233dde18aa679fbcf9889256239cc9e06","src/test_data/shift_jis_in.txt":"02e389ccef0dd2122e63f503899402cb7f797912c2444cc80ab93131116c5524","src/test_data/shift_jis_in_ref.txt":"512f985950ca902e643c88682dba9708b7c38d3c5ec2925168ab00ac94ab19f9","src/test_data/shift_jis_out.txt":"5fbc44da7bf639bf6cfe0fa1fd3eba7102b88f81919c9ea991302712f69426fb","src/test_data/shift_jis_out_ref.txt":"466322c6fed8286c64582731755290c2296508efdd258826e6279686649b481f","src/test_labels_names.rs":"c962c7aeac3d9ef2aca70c9e21983b231d4cf998cb06879374b0401e5149d1da","src/testing.rs":"b299d27055f3b068de66cc10a75c024b881c48bc093627c01e0b1f8bd7d94666","src/utf_16.rs":"32b6ecc3696542fb269a93c915e7402dde545e793f9599cf7dc63688fa226e0d","src/utf_8.rs":"5d16295faf1707b2058629eb2467200b86b02acfceda27433ac1d05ac385f9f3","src/utf_8_core.rs":"fe218284dbb9111a2336ff1684d7f58b55d9c4fe7363089a29e57f52901f0707","src/variant.rs":"e2c988a645429fd7457d7fbc487b838ab7ec7bfb8943d192992f18bbac8973f0","src/x_user_defined.rs":"1d25920ec5d005cbd623f34473d68991521aa3a83e52d4eb9b645711f10cd484"},"package":"2a91912d6f37c6a8fef8a2316a862542d036f13c923ad518b5aca7bcaac7544c"} \ No newline at end of file diff --git a/third_party/rust/encoding_rs/Cargo.toml b/third_party/rust/encoding_rs/Cargo.toml index b7b3bc33ae18..136f1331a40d 100644 --- a/third_party/rust/encoding_rs/Cargo.toml +++ b/third_party/rust/encoding_rs/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "encoding_rs" -version = "0.8.4" +version = "0.8.6" authors = ["Henri Sivonen "] description = "A Gecko-oriented implementation of the Encoding Standard" homepage = "https://docs.rs/encoding_rs/" diff --git a/third_party/rust/encoding_rs/README.md b/third_party/rust/encoding_rs/README.md index b3deb3fd5fb2..7af3d92ac6c1 100644 --- a/third_party/rust/encoding_rs/README.md +++ b/third_party/rust/encoding_rs/README.md @@ -68,6 +68,13 @@ Additionally, `encoding_rs::mem` does the following: * Converts ASCII to UTF-16 up to the first non-ASCII byte. * Converts UTF-16 to ASCII up to the first non-Basic Latin code unit. +## Integration with `std::io` + +Notably, the above feature list doesn't include the capability to wrap +a `std::io::Read`, decode it into UTF-8 and presenting the result via +`std::io::Read`. The [`encoding_rs_io`](https://crates.io/crates/encoding_rs_io) +crate provides that capability. + ## Licensing Please see the file named @@ -237,6 +244,22 @@ used in Firefox. ## Release Notes +### 0.8.6 + +* Temporarily removed the debug assertion added in version 0.8.5 from + `convert_utf16_to_latin1_lossy`. + +### 0.8.5 + +* If debug assertions are enabled but fuzzing isn't enabled, lossy conversions + to Latin1 in the `mem` module assert that the input is in the range + U+0000...U+00FF (inclusive). +* In the `mem` module provide conversions from Latin1 and UTF-16 to UTF-8 + that can deal with insufficient output space. The idea is to use them + first with an allocation rounded up to jemalloc bucket size and do the + worst-case allocation only if the jemalloc rounding up was insufficient + as the first guess. + ### 0.8.4 * Fix SSE2-specific, `simd-accel`-specific memory corruption introduced in diff --git a/third_party/rust/encoding_rs/src/lib.rs b/third_party/rust/encoding_rs/src/lib.rs index e8c7ef9df33d..1dd280ee0658 100644 --- a/third_party/rust/encoding_rs/src/lib.rs +++ b/third_party/rust/encoding_rs/src/lib.rs @@ -8,7 +8,7 @@ // except according to those terms. #![cfg_attr(feature = "cargo-clippy", allow(doc_markdown, inline_always, new_ret_no_self))] -#![doc(html_root_url = "https://docs.rs/encoding_rs/0.8.4")] +#![doc(html_root_url = "https://docs.rs/encoding_rs/0.8.6")] //! encoding_rs is a Gecko-oriented Free Software / Open Source implementation //! of the [Encoding Standard](https://encoding.spec.whatwg.org/) in Rust. @@ -36,6 +36,13 @@ //! The [repository is on GitHub](https://github.com/hsivonen/encoding_rs). The //! [crate is available on crates.io](https://crates.io/crates/encoding_rs). //! +//! # Integration with `std::io` +//! +//! This crate doesn't implement traits from `std::io`. However, for the case of +//! wrapping a `std::io::Read` in a decoder that implements `std::io::Read` and +//! presents the data from the wrapped `std::io::Read` as UTF-8 is addressed by +//! the [`encoding_rs_io`](https://docs.rs/encoding_rs_io/) crate. +//! //! # Examples //! //! Example programs: diff --git a/third_party/rust/encoding_rs/src/mem.rs b/third_party/rust/encoding_rs/src/mem.rs index 81c5b6e0ff0a..4fa83decaa3c 100644 --- a/third_party/rust/encoding_rs/src/mem.rs +++ b/third_party/rust/encoding_rs/src/mem.rs @@ -31,6 +31,10 @@ use super::EncoderResult; use ascii::*; use utf_8::*; +macro_rules! non_fuzz_debug_assert { + ($($arg:tt)*) => (if !cfg!(fuzzing) { debug_assert!($($arg)*); }) +} + cfg_if!{ if #[cfg(feature = "simd-accel")] { use ::std::intrinsics::unlikely; @@ -1547,6 +1551,33 @@ pub fn convert_str_to_utf16(src: &str, dst: &mut [u16]) -> usize { } } +/// Converts potentially-invalid UTF-16 to valid UTF-8 with errors replaced +/// with the REPLACEMENT CHARACTER with potentially insufficient output +/// space. +/// +/// Returns the number of code units read and the number of bytes written. +/// +/// Not all code units are read if there isn't enough output space. +/// +/// Note that this method isn't designed for general streamability but for +/// not allocating memory for the worst case up front. Specifically, +/// if the input starts with or ends with an unpaired surrogate, those are +/// replaced with the REPLACEMENT CHARACTER. +/// +/// # Safety +/// +/// Note that this function may write garbage beyond the number of bytes +/// indicated by the return value, so using a `&mut str` interpreted as +/// `&mut [u8]` as the destination is not safe. If you want to convert into +/// a `&mut str`, use `convert_utf16_to_str()` instead of this function. +#[inline] +pub fn convert_utf16_to_utf8_partial(src: &[u16], dst: &mut [u8]) -> (usize, usize) { + let mut encoder = Utf8Encoder; + let (result, read, written) = encoder.encode_from_utf16_raw(src, dst, true); + debug_assert!(result == EncoderResult::OutputFull || read == src.len()); + (read, written) +} + /// Converts potentially-invalid UTF-16 to valid UTF-8 with errors replaced /// with the REPLACEMENT CHARACTER. /// @@ -1568,12 +1599,42 @@ pub fn convert_str_to_utf16(src: &str, dst: &mut [u16]) -> usize { #[inline] pub fn convert_utf16_to_utf8(src: &[u16], dst: &mut [u8]) -> usize { assert!(dst.len() >= src.len() * 3 + 1); - let mut encoder = Utf8Encoder; - let (result, _, written) = encoder.encode_from_utf16_raw(src, dst, true); - debug_assert!(result == EncoderResult::InputEmpty); + let (read, written) = convert_utf16_to_utf8_partial(src, dst); + debug_assert_eq!(read, src.len()); written } +/// Converts potentially-invalid UTF-16 to valid UTF-8 with errors replaced +/// with the REPLACEMENT CHARACTER such that the validity of the output is +/// signaled using the Rust type system with potentially insufficient output +/// space. +/// +/// Returns the number of code units read and the number of bytes written. +/// +/// Not all code units are read if there isn't enough output space. +/// +/// Note that this method isn't designed for general streamability but for +/// not allocating memory for the worst case up front. Specifically, +/// if the input starts with or ends with an unpaired surrogate, those are +/// replaced with the REPLACEMENT CHARACTER. +#[inline] +pub fn convert_utf16_to_str_partial(src: &[u16], dst: &mut str) -> (usize, usize) { + let bytes: &mut [u8] = unsafe { ::std::mem::transmute(dst) }; + let (read, written) = convert_utf16_to_utf8_partial(src, bytes); + let len = bytes.len(); + let mut trail = written; + let max = ::std::cmp::min(len, trail + MAX_STRIDE_SIZE); + while trail < max { + bytes[trail] = 0; + trail += 1; + } + while trail < len && ((bytes[trail] & 0xC0) == 0x80) { + bytes[trail] = 0; + trail += 1; + } + (read, written) +} + /// Converts potentially-invalid UTF-16 to valid UTF-8 with errors replaced /// with the REPLACEMENT CHARACTER such that the validity of the output is /// signaled using the Rust type system. @@ -1588,19 +1649,9 @@ pub fn convert_utf16_to_utf8(src: &[u16], dst: &mut [u8]) -> usize { /// Panics if the destination buffer is shorter than stated above. #[inline] pub fn convert_utf16_to_str(src: &[u16], dst: &mut str) -> usize { - let bytes: &mut [u8] = unsafe { ::std::mem::transmute(dst) }; - let written = convert_utf16_to_utf8(src, bytes); - let len = bytes.len(); - let mut trail = written; - let max = ::std::cmp::min(len, trail + MAX_STRIDE_SIZE); - while trail < max { - bytes[trail] = 0; - trail += 1; - } - while trail < len && ((bytes[trail] & 0xC0) == 0x80) { - bytes[trail] = 0; - trail += 1; - } + assert!(dst.len() >= src.len() * 3 + 1); + let (read, written) = convert_utf16_to_str_partial(src, dst); + debug_assert_eq!(read, src.len()); written } @@ -1629,6 +1680,59 @@ pub fn convert_latin1_to_utf16(src: &[u8], dst: &mut [u16]) { } } +/// Converts bytes whose unsigned value is interpreted as Unicode code point +/// (i.e. U+0000 to U+00FF, inclusive) to UTF-8 with potentially insufficient +/// output space. +/// +/// Returns the number of bytes read and the number of bytes written. +/// +/// If the output isn't large enough, not all input is consumed. +/// +/// # Safety +/// +/// Note that this function may write garbage beyond the number of bytes +/// indicated by the return value, so using a `&mut str` interpreted as +/// `&mut [u8]` as the destination is not safe. If you want to convert into +/// a `&mut str`, use `convert_utf16_to_str()` instead of this function. +#[inline] +pub fn convert_latin1_to_utf8_partial(src: &[u8], dst: &mut [u8]) -> (usize, usize) { + let src_len = src.len(); + let src_ptr = src.as_ptr(); + let dst_ptr = dst.as_mut_ptr(); + let dst_len = dst.len(); + let mut total_read = 0usize; + let mut total_written = 0usize; + loop { + // src can't advance more than dst + let src_left = src_len - total_read; + let dst_left = dst_len - total_written; + let min_left = ::std::cmp::min(src_left, dst_left); + if let Some((non_ascii, consumed)) = unsafe { + ascii_to_ascii( + src_ptr.offset(total_read as isize), + dst_ptr.offset(total_written as isize), + min_left, + ) + } { + total_read += consumed; + total_written += consumed; + if total_written.checked_add(2).unwrap() > dst_len { + return (total_read, total_written); + } + + total_read += 1; // consume `non_ascii` + + let code_point = non_ascii as u32; + dst[total_written] = ((code_point >> 6) | 0xC0u32) as u8; + total_written += 1; + dst[total_written] = ((code_point as u32 & 0x3Fu32) | 0x80u32) as u8; + total_written += 1; + continue; + } + return (total_read + min_left, total_written + min_left); + } +} + /// Converts bytes whose unsigned value is interpreted as Unicode code point /// (i.e. U+0000 to U+00FF, inclusive) to UTF-8. /// @@ -1653,33 +1757,35 @@ pub fn convert_latin1_to_utf8(src: &[u8], dst: &mut [u8]) -> usize { dst.len() >= src.len() * 2, "Destination must not be shorter than the source times two." ); - let src_len = src.len(); - let src_ptr = src.as_ptr(); - let dst_ptr = dst.as_mut_ptr(); - let mut total_read = 0usize; - let mut total_written = 0usize; - loop { - // src can't advance more than dst - let src_left = src_len - total_read; - if let Some((non_ascii, consumed)) = unsafe { - ascii_to_ascii( - src_ptr.offset(total_read as isize), - dst_ptr.offset(total_written as isize), - src_left, - ) - } { - total_read += consumed + 1; - total_written += consumed; + let (read, written) = convert_latin1_to_utf8_partial(src, dst); + debug_assert_eq!(read, src.len()); + written +} - let code_point = non_ascii as u32; - dst[total_written] = ((code_point >> 6) | 0xC0u32) as u8; - total_written += 1; - dst[total_written] = ((code_point as u32 & 0x3Fu32) | 0x80u32) as u8; - total_written += 1; - continue; - } - return total_written + src_left; +/// Converts bytes whose unsigned value is interpreted as Unicode code point +/// (i.e. U+0000 to U+00FF, inclusive) to UTF-8 such that the validity of the +/// output is signaled using the Rust type system with potentially insufficient +/// output space. +/// +/// Returns the number of bytes read and the number of bytes written. +/// +/// If the output isn't large enough, not all input is consumed. +#[inline] +pub fn convert_latin1_to_str_partial(src: &[u8], dst: &mut str) -> (usize, usize) { + let bytes: &mut [u8] = unsafe { ::std::mem::transmute(dst) }; + let (read, written) = convert_latin1_to_utf8_partial(src, bytes); + let len = bytes.len(); + let mut trail = written; + let max = ::std::cmp::min(len, trail + MAX_STRIDE_SIZE); + while trail < max { + bytes[trail] = 0; + trail += 1; } + while trail < len && ((bytes[trail] & 0xC0) == 0x80) { + bytes[trail] = 0; + trail += 1; + } + (read, written) } /// Converts bytes whose unsigned value is interpreted as Unicode code point @@ -1696,19 +1802,12 @@ pub fn convert_latin1_to_utf8(src: &[u8], dst: &mut [u8]) -> usize { /// Panics if the destination buffer is shorter than stated above. #[inline] pub fn convert_latin1_to_str(src: &[u8], dst: &mut str) -> usize { - let bytes: &mut [u8] = unsafe { ::std::mem::transmute(dst) }; - let written = convert_latin1_to_utf8(src, bytes); - let len = bytes.len(); - let mut trail = written; - let max = ::std::cmp::min(len, trail + MAX_STRIDE_SIZE); - while trail < max { - bytes[trail] = 0; - trail += 1; - } - while trail < len && ((bytes[trail] & 0xC0) == 0x80) { - bytes[trail] = 0; - trail += 1; - } + assert!( + dst.len() >= src.len() * 2, + "Destination must not be shorter than the source times two." + ); + let (read, written) = convert_latin1_to_str_partial(src, dst); + debug_assert_eq!(read, src.len()); written } @@ -1718,6 +1817,7 @@ pub fn convert_latin1_to_str(src: &[u8], dst: &mut str) -> usize { /// each output byte. /// /// If the input does not fulfill the condition stated above, this function +/// panics if debug assertions are enabled (and fuzzing isn't) and otherwise /// does something that is memory-safe without any promises about any /// properties of the output. In particular, callers shouldn't assume the /// output to be the same across crate versions or CPU architectures and @@ -1731,12 +1831,16 @@ pub fn convert_latin1_to_str(src: &[u8], dst: &mut str) -> usize { /// # Panics /// /// Panics if the destination buffer is shorter than stated above. +/// +/// If debug assertions are enabled (and not fuzzing) and the input is +/// not in the range U+0000 to U+00FF, inclusive. #[inline] pub fn convert_utf8_to_latin1_lossy(src: &[u8], dst: &mut [u8]) -> usize { assert!( dst.len() >= src.len(), "Destination must not be shorter than the source." ); + non_fuzz_debug_assert!(is_utf8_latin1(src)); let src_len = src.len(); let src_ptr = src.as_ptr(); let dst_ptr = dst.as_mut_ptr(); @@ -1776,11 +1880,12 @@ pub fn convert_utf8_to_latin1_lossy(src: &[u8], dst: &mut [u8]) -> usize { /// represents the value of each code point as the unsigned byte value of /// each output byte. /// -/// If the input does not fulfill the condition stated above, this function -/// does something that is memory-safe without any promises about any -/// properties of the output. In particular, callers shouldn't assume the -/// output to be the same across crate versions or CPU architectures and -/// should not assume that non-Basic Latin input can't map to ASCII output. +/// If the input does not fulfill the condition stated above, does something +/// that is memory-safe without any promises about any properties of the +/// output and will probably assert in debug builds in future versions. +/// In particular, callers shouldn't assume the output to be the same across +/// crate versions or CPU architectures and should not assume that non-ASCII +/// input can't map to ASCII output. /// /// The length of the destination buffer must be at least the length of the /// source buffer. @@ -1790,12 +1895,16 @@ pub fn convert_utf8_to_latin1_lossy(src: &[u8], dst: &mut [u8]) -> usize { /// # Panics /// /// Panics if the destination buffer is shorter than stated above. +/// +/// (Probably in future versions if debug assertions are enabled (and not +/// fuzzing) and the input is not in the range U+0000 to U+00FF, inclusive.) #[inline] pub fn convert_utf16_to_latin1_lossy(src: &[u16], dst: &mut [u8]) { assert!( dst.len() >= src.len(), "Destination must not be shorter than the source." ); + // non_fuzz_debug_assert!(is_utf16_latin1(src)); unsafe { pack_latin1(src.as_ptr(), dst.as_mut_ptr(), src.len()); } @@ -2100,6 +2209,18 @@ mod tests { assert_eq!(dst, reference); } + #[test] + fn test_convert_utf16_to_utf8_partial() { + let reference = "abcdefghijklmnopqrstu\u{1F4A9}v\u{2603}w\u{00B6}xyzz"; + let src: Vec = reference.encode_utf16().collect(); + let mut dst: Vec = Vec::with_capacity(src.len() * 3 + 1); + dst.resize(src.len() * 3 + 1, 0); + let (read, written) = convert_utf16_to_utf8_partial(&src[..], &mut dst[..24]); + let len = written + convert_utf16_to_utf8(&src[read..], &mut dst[written..]); + dst.truncate(len); + assert_eq!(dst, reference.as_bytes()); + } + #[test] fn test_convert_utf16_to_utf8() { let reference = "abcdefghijklmnopqrstu\u{1F4A9}v\u{2603}w\u{00B6}xyzz"; @@ -2127,6 +2248,14 @@ mod tests { assert_eq!(dst, reference); } + #[test] + fn test_convert_latin1_to_utf8_partial() { + let mut dst = [0u8, 2]; + let (read, written) = convert_latin1_to_utf8_partial(b"a\xFF", &mut dst[..]); + assert_eq!(read, 1); + assert_eq!(written, 1); + } + #[test] fn test_convert_latin1_to_utf8() { let mut src: Vec = Vec::with_capacity(256); @@ -2163,6 +2292,13 @@ mod tests { assert_eq!(dst, reference); } + #[test] + #[should_panic] + fn test_convert_utf8_to_latin1_lossy_panics() { + let mut dst = [0u8; 16]; + let _ = convert_utf8_to_latin1_lossy("\u{100}".as_bytes(), &mut dst[..]); + } + #[test] fn test_convert_utf16_to_latin1_lossy() { let mut src: Vec = Vec::with_capacity(256); @@ -2179,6 +2315,13 @@ mod tests { assert_eq!(dst, reference); } + #[test] + // #[should_panic] + fn test_convert_utf16_to_latin1_lossy_panics() { + let mut dst = [0u8; 16]; + let _ = convert_utf16_to_latin1_lossy(&[0x0100u16], &mut dst[..]); + } + #[test] fn test_utf16_valid_up_to() { let valid = vec![