Read full message in ReadBinaryProto().
Add call to coded_stream.ConsumedEntireMessage() in ReadBinaryProto() to ensure that full message is read, and that ReadBinaryProto() does not report success on a partial read.
This commit is contained in:
parent
b06f06148e
commit
0b86daa483
@ -517,7 +517,8 @@ Status ReadBinaryProto(Env* env, const string& fname,
|
|||||||
// respectively.
|
// respectively.
|
||||||
coded_stream.SetTotalBytesLimit(1024LL << 20, 512LL << 20);
|
coded_stream.SetTotalBytesLimit(1024LL << 20, 512LL << 20);
|
||||||
|
|
||||||
if (!proto->ParseFromCodedStream(&coded_stream)) {
|
if (!proto->ParseFromCodedStream(&coded_stream) ||
|
||||||
|
!coded_stream.ConsumedEntireMessage()) {
|
||||||
TF_RETURN_IF_ERROR(stream->status());
|
TF_RETURN_IF_ERROR(stream->status());
|
||||||
return errors::DataLoss("Can't parse ", fname, " as binary proto");
|
return errors::DataLoss("Can't parse ", fname, " as binary proto");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user