diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc index 994026346e..f29a8c213f 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc @@ -467,6 +467,18 @@ int64_t LimitingInputStream::ByteCount() const { } } +bool LimitingInputStream::ReadCord(absl::Cord* cord, int count) { + if (count <= 0) return true; + if (count <= limit_) { + if (!input_->ReadCord(cord, count)) return false; + limit_ -= count; + return true; + } + input_->ReadCord(cord, limit_); + limit_ = 0; + return false; +} + // =================================================================== diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/src/google/protobuf/io/zero_copy_stream_impl_lite.h index a23713c622..21fe8c4574 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -375,6 +375,7 @@ class PROTOBUF_EXPORT LimitingInputStream PROTOBUF_FUTURE_FINAL void BackUp(int count) override; bool Skip(int count) override; int64_t ByteCount() const override; + bool ReadCord(absl::Cord* cord, int count) override; private: