summaryrefslogtreecommitdiff
path: root/caffe2/sgd
diff options
context:
space:
mode:
authorMichael Antonov <michael.antonov@oculus.com>2018-10-23 16:19:23 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-10-23 16:21:26 -0700
commita6949abb158d1408c5c53d9eeafde16543160c94 (patch)
treeee6438870056691c17bd724d3223dc2840f70b5f /caffe2/sgd
parentdd00c2997f4336cb02d0dd6c9d3c8cf7beada8f5 (diff)
downloadpytorch-a6949abb158d1408c5c53d9eeafde16543160c94.tar.gz
pytorch-a6949abb158d1408c5c53d9eeafde16543160c94.tar.bz2
pytorch-a6949abb158d1408c5c53d9eeafde16543160c94.zip
Guard all Caffe2 protobuf string serializations with CAFFE_ENFORCE (fixed reverted bug) (#12848)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12848 Updated all non-test uses of protobuf::MessageLite::SerializeAsString to call SerializeAsString_EnforceCheck so that the return value is checked and can throw an exception if failing. Most of the affected code was called from classes derived from BlobSerializeBase. Didn't touch most tests and ENFORCE calls because they usually do checks anyway. Original commit changeset: c0760e73ecc7 Reviewed By: dzhulgakov Differential Revision: D10453456 fbshipit-source-id: d2f2b7b4578e721924354149f08f627c7e3bf070
Diffstat (limited to 'caffe2/sgd')
-rw-r--r--caffe2/sgd/iter_op.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/caffe2/sgd/iter_op.cc b/caffe2/sgd/iter_op.cc
index 222b20fb6f..8b851e0ba1 100644
--- a/caffe2/sgd/iter_op.cc
+++ b/caffe2/sgd/iter_op.cc
@@ -17,7 +17,7 @@ void MutexSerializer::Serialize(
blob_proto.set_name(name);
blob_proto.set_type("std::unique_ptr<std::mutex>");
blob_proto.set_content("");
- acceptor(name, blob_proto.SerializeAsString());
+ acceptor(name, SerializeBlobProtoAsString_EnforceCheck(blob_proto));
}
void MutexDeserializer::Deserialize(const BlobProto& /* unused */, Blob* blob) {