summaryrefslogtreecommitdiff
path: root/binaries
diff options
context:
space:
mode:
authorMichael Antonov <michael.antonov@oculus.com>2018-10-18 12:47:12 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-10-18 12:49:01 -0700
commit63cd051867b830ec62ecdf16da319e4522c506fd (patch)
tree972722fb9b493347239778ec869105b433b18f81 /binaries
parent2c566a17c763ab000ebeba1d3c01762bae814e42 (diff)
downloadpytorch-63cd051867b830ec62ecdf16da319e4522c506fd.tar.gz
pytorch-63cd051867b830ec62ecdf16da319e4522c506fd.tar.bz2
pytorch-63cd051867b830ec62ecdf16da319e4522c506fd.zip
Guard all Caffe2 protobuf string serializations with CAFFE_ENFORCE (#12799)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12799 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. Reviewed By: ezyang Differential Revision: D10416438 fbshipit-source-id: cb842e3e26b0918829d71267a375d4dd40600d58
Diffstat (limited to 'binaries')
-rw-r--r--binaries/convert_caffe_image_db.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/binaries/convert_caffe_image_db.cc b/binaries/convert_caffe_image_db.cc
index de7efbf65b..dca13d6e97 100644
--- a/binaries/convert_caffe_image_db.cc
+++ b/binaries/convert_caffe_image_db.cc
@@ -79,7 +79,7 @@ int main(int argc, char** argv) {
data->add_dims(datum.channels());
data->set_byte_data(buffer, datum.data().size());
}
- transaction->Put(cursor->key(), protos.SerializeAsString());
+ transaction->Put(cursor->key(), SerializeAsString_EnforceCheck(protos));
if (++count % FLAGS_batch_size == 0) {
transaction->Commit();
LOG(INFO) << "Converted " << count << " items so far.";
@@ -88,4 +88,3 @@ int main(int argc, char** argv) {
LOG(INFO) << "A total of " << count << " items processed.";
return 0;
}
-