aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Xiao <xfxyjwf@gmail.com>2017-08-08 15:49:20 -0700
committerGitHub <noreply@github.com>2017-08-08 15:49:20 -0700
commit35db2675b418ea105ef89f88fd1bf0257eb8a3ff (patch)
treea3a7f35d4279cd1391ef31daa65ac2b326ea1448
parent80e984e0076ea029cf5431f15dfdf94c5b73b83f (diff)
parenta68a8004b5ab0e2744a204fdaa6a465f00961244 (diff)
downloadprotobuf-35db2675b418ea105ef89f88fd1bf0257eb8a3ff.tar.gz
protobuf-35db2675b418ea105ef89f88fd1bf0257eb8a3ff.tar.bz2
protobuf-35db2675b418ea105ef89f88fd1bf0257eb8a3ff.zip
Merge pull request #3473 from AlanBurlison/master
PROTBUF-3394 Potential SIGBUS with UnsafeUtil.getLong
-rw-r--r--java/core/src/main/java/com/google/protobuf/Utf8.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java
index be7b746e..d98e914d 100644
--- a/java/core/src/main/java/com/google/protobuf/Utf8.java
+++ b/java/core/src/main/java/com/google/protobuf/Utf8.java
@@ -1362,7 +1362,7 @@ final class Utf8 {
// Read bytes until 8-byte aligned so that we can read longs in the loop below.
// We do this by ANDing the address with 7 to determine the number of bytes that need to
// be read before we're 8-byte aligned.
- final int unaligned = (int) address & 7;
+ final int unaligned = 8 - ((int) address & 7);
for (int j = unaligned; j > 0; j--) {
if (UnsafeUtil.getByte(address++) < 0) {
return unaligned - j;