From 1d77059e4b1ec17c704acfc876e321cc33bff99d Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Thu, 19 Jan 2017 11:44:42 -0800
Subject: [PATCH] Fix integer overflow

---
 include/grpc++/impl/codegen/proto_utils.h | 2 +-
 include/grpc++/impl/codegen/sync_stream.h | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h
index acaa48afee..2123b62ed9 100644
--- a/include/grpc++/impl/codegen/proto_utils.h
+++ b/include/grpc++/impl/codegen/proto_utils.h
@@ -214,7 +214,7 @@ class SerializationTraits<T, typename std::enable_if<std::is_base_of<
         return reader.status();
       }
       ::grpc::protobuf::io::CodedInputStream decoder(&reader);
-      decoder.SetTotalBytesLimit(UINT32_MAX, UINT32_MAX);
+      decoder.SetTotalBytesLimit(INT_MAX, INT_MAX);
       if (!msg->ParseFromCodedStream(&decoder)) {
         result = Status(StatusCode::INTERNAL, msg->InitializationErrorString());
       }
diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h
index e0f9ba7701..1f7708bab9 100644
--- a/include/grpc++/impl/codegen/sync_stream.h
+++ b/include/grpc++/impl/codegen/sync_stream.h
@@ -160,7 +160,7 @@ class ClientReader final : public ClientReaderInterface<R> {
   }
 
   bool NextMessageSize(uint32_t* sz) override {
-    *sz = UINT32_MAX;
+    *sz = INT_MAX;
     return true;
   }
 
@@ -310,7 +310,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
   }
 
   bool NextMessageSize(uint32_t* sz) override {
-    *sz = UINT32_MAX;
+    *sz = INT_MAX;
     return true;
   }
 
@@ -382,7 +382,7 @@ class ServerReader final : public ServerReaderInterface<R> {
   }
 
   bool NextMessageSize(uint32_t* sz) override {
-    *sz = UINT32_MAX;
+    *sz = INT_MAX;
     return true;
   }
 
@@ -474,7 +474,7 @@ class ServerReaderWriterBody final {
   }
 
   bool NextMessageSize(uint32_t* sz) {
-    *sz = UINT32_MAX;
+    *sz = INT_MAX;
     return true;
   }
 
-- 
GitLab