From 953adb16ff2f982d54dd812b51df5fdb392732f8 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Wed, 31 Jan 2018 11:59:57 -0500 Subject: Add casts to removed undefined behaviors around shifts. Fixes #4246 Fixes #4247 --- objectivec/GPBCodedInputStream.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'objectivec/GPBCodedInputStream.m') 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; } -- cgit v1.2.3