about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorblake2-ppc <blake2-ppc>2013-07-30 17:17:21 +0200
committerblake2-ppc <blake2-ppc>2013-07-30 17:25:29 +0200
commit6dd185930d850b653ae4e5f4c37c3f1a2b64e4cf (patch)
tree0176c049a16a20097efda6cb22a89e76b0d16a66 /src/libstd
parent576f395ddfe3a47859df0419a0366abf7a8c185b (diff)
downloadrust-6dd185930d850b653ae4e5f4c37c3f1a2b64e4cf.tar.gz
rust-6dd185930d850b653ae4e5f4c37c3f1a2b64e4cf.zip
std: Disallow bytes 0xC0, 0xC1 (192, 193) in utf-8
Bytes 0xC0, 0xC1 can only be used to start 2-byte codepoint encodings,
that are 'overlong encodings' of codepoints below 128.

The reference given in a comment -- https://tools.ietf.org/html/rfc3629
-- does in fact already exclude these bytes, so no additional comment
should be needed in the code.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/str.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 6981005ed2f..1669f0c7976 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -712,7 +712,7 @@ static UTF8_CHAR_WIDTH: [u8, ..256] = [
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF
-2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF
 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF
 4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF