xref: /aosp_15_r20/external/cronet/third_party/protobuf/patches/0036-fix-undefined-memcpy-call.patch (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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