aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/protobuf_util.cc
blob: b698d3f0c2887fb5a8b06e5f5c0b62c196ccdcd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "tensorflow/core/platform/protobuf.h"

namespace tensorflow {

bool ParseProtoUnlimited(protobuf::Message* proto, const string& serialized) {
  return ParseProtoUnlimited(proto, serialized.data(), serialized.size());
}

bool ParseProtoUnlimited(protobuf::Message* proto, const void* serialized,
                         size_t size) {
  protobuf::io::CodedInputStream coded_stream(
      reinterpret_cast<const uint8*>(serialized), size);
  coded_stream.SetTotalBytesLimit(INT_MAX, INT_MAX);
  return proto->ParseFromCodedStream(&coded_stream);
}

}  // namespace tensorflow