1diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h
2index 15051c3eba82f..525ddb2a22870 100644
3--- a/src/google/protobuf/parse_context.h
4+++ b/src/google/protobuf/parse_context.h
5@@ -327,7 +327,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream {
6
7   template <typename A>
8   const char* AppendSize(const char* ptr, int size, const A& append) {
9-    int chunk_size = buffer_end_ + kSlopBytes - ptr;
10+    int chunk_size = static_cast<int>(buffer_end_ + kSlopBytes - ptr);
11     do {
12       GOOGLE_DCHECK(size > chunk_size);
13       if (next_chunk_ == nullptr) return nullptr;
14@@ -341,7 +341,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream {
15       ptr = Next();
16       if (ptr == nullptr) return nullptr;  // passed the limit
17       ptr += kSlopBytes;
18-      chunk_size = buffer_end_ + kSlopBytes - ptr;
19+      chunk_size = static_cast<int>(buffer_end_ + kSlopBytes - ptr);
20     } while (size > chunk_size);
21     append(ptr, size);
22     return ptr + size;
23@@ -785,7 +785,7 @@ template <typename T>
24 const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
25                                                 RepeatedField<T>* out) {
26   GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
27-  int nbytes = buffer_end_ + kSlopBytes - ptr;
28+  int nbytes = static_cast<int>(buffer_end_ + kSlopBytes - ptr);
29   while (size > nbytes) {
30     int num = nbytes / sizeof(T);
31     int old_entries = out->size();
32@@ -803,7 +803,7 @@ const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
33     ptr = Next();
34     if (ptr == nullptr) return nullptr;
35     ptr += kSlopBytes - (nbytes - block_size);
36-    nbytes = buffer_end_ + kSlopBytes - ptr;
37+    nbytes = static_cast<int>(buffer_end_ + kSlopBytes - ptr);
38   }
39   int num = size / sizeof(T);
40   int old_entries = out->size();
41@@ -835,11 +835,11 @@ template <typename Add>
42 const char* EpsCopyInputStream::ReadPackedVarint(const char* ptr, Add add) {
43   int size = ReadSize(&ptr);
44   GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
45-  int chunk_size = buffer_end_ - ptr;
46+  int chunk_size = static_cast<int>(buffer_end_ - ptr);
47   while (size > chunk_size) {
48     ptr = ReadPackedVarintArray(ptr, buffer_end_, add);
49     if (ptr == nullptr) return nullptr;
50-    int overrun = ptr - buffer_end_;
51+    int overrun = static_cast<int>(ptr - buffer_end_);
52     GOOGLE_DCHECK(overrun >= 0 && overrun <= kSlopBytes);
53     if (size - chunk_size <= kSlopBytes) {
54       // The current buffer contains all the information needed, we don't need
55@@ -860,7 +860,7 @@ const char* EpsCopyInputStream::ReadPackedVarint(const char* ptr, Add add) {
56     ptr = Next();
57     if (ptr == nullptr) return nullptr;
58     ptr += overrun;
59-    chunk_size = buffer_end_ - ptr;
60+    chunk_size = static_cast<int>(buffer_end_ - ptr);
61   }
62   auto end = ptr + size;
63   ptr = ReadPackedVarintArray(ptr, end, add);
64@@ -883,7 +883,7 @@ PROTOBUF_NODISCARD PROTOBUF_EXPORT const char* InlineGreedyStringParser(
65 template <typename T>
66 PROTOBUF_NODISCARD const char* FieldParser(uint64_t tag, T& field_parser,
67                                            const char* ptr, ParseContext* ctx) {
68-  uint32_t number = tag >> 3;
69+  uint32_t number = static_cast<uint32_t>(tag >> 3);
70   GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0);
71   using WireType = internal::WireFormatLite::WireType;
72   switch (tag & 7) {
73