Skip to content

Commit

Permalink
[Runtime] Remove read limit of ReadBinaryProto. (#981)
Browse files Browse the repository at this point in the history
Signed-off-by: Secret.Sun <sunputonsteam@gmail.com>
  • Loading branch information
SecretSun authored Apr 10, 2024
1 parent cf16856 commit d5f7f6a
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions tensorflow/core/platform/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,7 @@ Status ReadBinaryProto(Env* env, const string& fname,
TF_RETURN_IF_ERROR(env->NewRandomAccessFile(fname, &file));
std::unique_ptr<FileStream> stream(new FileStream(file.get()));

// TODO(jiayq): the following coded stream is for debugging purposes to allow
// one to parse arbitrarily large messages for MessageLite. One most likely
// doesn't want to put protobufs larger than 64MB on Android, so we should
// eventually remove this and quit loud when a large protobuf is passed in.
::tensorflow::protobuf::io::CodedInputStream coded_stream(stream.get());
// Total bytes hard limit / warning limit are set to 1GB and 512MB
// respectively.
coded_stream.SetTotalBytesLimit(1024LL << 20, 512LL << 20);

if (!proto->ParseFromCodedStream(&coded_stream) ||
!coded_stream.ConsumedEntireMessage()) {
Expand Down

0 comments on commit d5f7f6a

Please sign in to comment.