1diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h 2index c00048d1670da..7c2385be48b8a 100644 3--- a/src/google/protobuf/parse_context.h 4+++ b/src/google/protobuf/parse_context.h 5@@ -236,7 +236,9 @@ class PROTOBUF_EXPORT EpsCopyInputStream { 6 if (aliasing_ == kOnPatch) aliasing_ = kNoDelta; 7 return flat.data(); 8 } else { 9- std::memcpy(buffer_, flat.data(), flat.size()); 10+ if (!flat.empty()) { 11+ std::memcpy(buffer_, flat.data(), flat.size()); 12+ } 13 limit_ = 0; 14 limit_end_ = buffer_end_ = buffer_ + flat.size(); 15 next_chunk_ = nullptr; 16