about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJustin Ridgewell <justin@ridgewell.name>2019-07-05 16:39:56 -0400
committerJustin Ridgewell <justin@ridgewell.name>2019-07-05 16:39:56 -0400
commit3b6e8ed502e351d5d8daa3ac0c61a4e44b428d98 (patch)
tree5ed3525f928d496ed0159cf2836972852a34bebf
parent3d2c4ff45689df3c5a9196809a2b97315711d1fb (diff)
downloadrust-3b6e8ed502e351d5d8daa3ac0c61a4e44b428d98.tar.gz
rust-3b6e8ed502e351d5d8daa3ac0c61a4e44b428d98.zip
Do not use pointer alignment on unsupported platforms
-rw-r--r--src/libcore/str/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 277dc6ff4a8..95756c27117 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -1497,7 +1497,7 @@ fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> {
             // Ascii case, try to skip forward quickly.
             // When the pointer is aligned, read 2 words of data per iteration
             // until we find a word containing a non-ascii byte.
-            if align.wrapping_sub(index) % usize_bytes == 0 {
+            if align != usize::max_value() && align.wrapping_sub(index) % usize_bytes == 0 {
                 let ptr = v.as_ptr();
                 while index < blocks_end {
                     unsafe {