aboutsummaryrefslogtreecommitdiffhomepage
path: root/java
diff options
context:
space:
mode:
authorGravatar alanbur <Alan.Burlison@oracle.com>2017-08-08 11:56:36 +0100
committerGravatar alanbur <Alan.Burlison@oracle.com>2017-08-08 11:56:36 +0100
commita68a8004b5ab0e2744a204fdaa6a465f00961244 (patch)
tree6a167099e806e180fdd54449b1c3ca84a100fa76 /java
parentfae381693f029da1456f6e90f91fe995723163f3 (diff)
PROTBUF-3394 Potential SIGBUS with UnsafeUtil.getLong
Diffstat (limited to 'java')
-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;