aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBCodedInputStream.m
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2018-01-31 11:59:57 -0500
committerThomas Van Lenten <thomasvl@google.com>2018-01-31 12:36:54 -0500
commit953adb16ff2f982d54dd812b51df5fdb392732f8 (patch)
treef6a855939173eaf8a5a4d6bfc84a87fff8255a0e /objectivec/GPBCodedInputStream.m
parentb718551571983f281d065e818da4fd9ca5723d89 (diff)
downloadprotobuf-953adb16ff2f982d54dd812b51df5fdb392732f8.tar.gz
protobuf-953adb16ff2f982d54dd812b51df5fdb392732f8.tar.bz2
protobuf-953adb16ff2f982d54dd812b51df5fdb392732f8.zip
Add casts to removed undefined behaviors around shifts.
Fixes #4246 Fixes #4247
Diffstat (limited to 'objectivec/GPBCodedInputStream.m')
-rw-r--r--objectivec/GPBCodedInputStream.m2
1 files changed, 1 insertions, 1 deletions
diff --git a/objectivec/GPBCodedInputStream.m b/objectivec/GPBCodedInputStream.m
index 0759640d..a8262e5d 100644
--- a/objectivec/GPBCodedInputStream.m
+++ b/objectivec/GPBCodedInputStream.m
@@ -110,7 +110,7 @@ static int64_t ReadRawVarint64(GPBCodedInputStreamState *state) {
int64_t result = 0;
while (shift < 64) {
int8_t b = ReadRawByte(state);
- result |= (int64_t)(b & 0x7F) << shift;
+ result |= (int64_t)((uint64_t)(b & 0x7F) << shift);
if ((b & 0x80) == 0) {
return result;
}