Index: third_party/protobuf/src/google/protobuf/io/coded_stream.cc |
diff --git a/third_party/protobuf/src/google/protobuf/io/coded_stream.cc b/third_party/protobuf/src/google/protobuf/io/coded_stream.cc |
index 6a91a13d4524f73e27f747b6aa58b794b6af90ff..57d486f958a274e86c0a1f2b843bfedc18611867 100644 |
--- a/third_party/protobuf/src/google/protobuf/io/coded_stream.cc |
+++ b/third_party/protobuf/src/google/protobuf/io/coded_stream.cc |
@@ -56,6 +56,15 @@ static const int kMaxVarintBytes = 10; |
static const int kMaxVarint32Bytes = 5; |
+inline bool NextNonEmpty(ZeroCopyInputStream* input, |
+ const void** data, int* size) { |
+ bool success; |
+ do { |
+ success = input->Next(data, size); |
+ } while (success && *size == 0); |
+ return success; |
+} |
+ |
} // namespace |
// CodedInputStream ================================================== |
@@ -489,7 +498,7 @@ bool CodedInputStream::Refresh() { |
const void* void_buffer; |
int buffer_size; |
- if (input_->Next(&void_buffer, &buffer_size)) { |
+ if (NextNonEmpty(input_, &void_buffer, &buffer_size)) { |
buffer_ = reinterpret_cast<const uint8*>(void_buffer); |
buffer_end_ = buffer_ + buffer_size; |
GOOGLE_CHECK_GE(buffer_size, 0); |