diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 22:34:46 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 22:34:46 +0000 |
commit | b388e926b70990b6be241c3c81281725ac0bca35 (patch) | |
tree | cc039a35760475533ccd598d5cb866b089a2e74a /sync | |
parent | b4ccf82c80a24c5bdc15ee7052a9e2e13e9d21bd (diff) | |
download | chromium_src-b388e926b70990b6be241c3c81281725ac0bca35.zip chromium_src-b388e926b70990b6be241c3c81281725ac0bca35.tar.gz chromium_src-b388e926b70990b6be241c3c81281725ac0bca35.tar.bz2 |
[Sync] Add check to help debug CreateOrUpdateSyncNode errors.
We check if we succeed in decrypting data, but fail in parsing the string into
a protobuf.
BUG=123223
TEST=
Review URL: https://chromiumcodereview.appspot.com/10387089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136695 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r-- | sync/internal_api/base_node.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sync/internal_api/base_node.cc b/sync/internal_api/base_node.cc index 552ee71..99f1614 100644 --- a/sync/internal_api/base_node.cc +++ b/sync/internal_api/base_node.cc @@ -118,10 +118,18 @@ bool BaseNode::DecryptIfNecessary() { const sync_pb::EncryptedData& encrypted = specifics.encrypted(); std::string plaintext_data = GetTransaction()->GetCryptographer()-> DecryptToString(encrypted); - if (plaintext_data.length() == 0 || - !unencrypted_data_.ParseFromString(plaintext_data)) { + if (plaintext_data.length() == 0) { LOG(ERROR) << "Failed to decrypt encrypted node of type " << syncable::ModelTypeToString(GetModelType()) << "."; + // Debugging for crbug.com/123223. We failed to decrypt the data, which + // means we applied an update without having the key or lost the key at a + // later point. + CHECK(false); + return false; + } else if (!unencrypted_data_.ParseFromString(plaintext_data)) { + // Debugging for crbug.com/123223. We should never succeed in decrypting + // but fail to parse into a protobuf. + CHECK(false); return false; } DVLOG(2) << "Decrypted specifics of type " |