commit | 953adb16ff2f982d54dd812b51df5fdb392732f8 | [log] [tgz] |
---|---|---|
author | Thomas Van Lenten <thomasvl@google.com> | Wed Jan 31 11:59:57 2018 -0500 |
committer | Thomas Van Lenten <thomasvl@google.com> | Wed Jan 31 12:36:54 2018 -0500 |
tree | f6a855939173eaf8a5a4d6bfc84a87fff8255a0e | |
parent | b718551571983f281d065e818da4fd9ca5723d89 [diff] [blame] |
Add casts to removed undefined behaviors around shifts. Fixes #4246 Fixes #4247
diff --git a/objectivec/GPBCodedInputStream.m b/objectivec/GPBCodedInputStream.m index 0759640..a8262e5 100644 --- a/objectivec/GPBCodedInputStream.m +++ b/objectivec/GPBCodedInputStream.m
@@ -110,7 +110,7 @@ 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; }