Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Unified Diff: sync/internal_api/base_node.cc

Issue 1161463005: [Sync] Don't crash for encryption errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sync/internal_api/sync_encryption_handler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/base_node.cc
diff --git a/sync/internal_api/base_node.cc b/sync/internal_api/base_node.cc
index 4d6d56fadbe88df2921a15c9b114d5595168158b..1121faa1f6bd6eb7f6a0b791a144a3cd8ffb1604 100644
--- a/sync/internal_api/base_node.cc
+++ b/sync/internal_api/base_node.cc
@@ -21,6 +21,7 @@
#include "sync/protocol/typed_url_specifics.pb.h"
#include "sync/syncable/directory.h"
#include "sync/syncable/entry.h"
+#include "sync/syncable/syncable_base_transaction.h"
#include "sync/syncable/syncable_id.h"
#include "sync/util/time.h"
@@ -56,7 +57,9 @@ bool BaseNode::DecryptIfNecessary() {
scoped_ptr<sync_pb::PasswordSpecificsData> data(DecryptPasswordSpecifics(
specifics, GetTransaction()->GetCryptographer()));
if (!data) {
- LOG(ERROR) << "Failed to decrypt password specifics.";
+ GetTransaction()->GetWrappedTrans()->OnUnrecoverableError(
+ FROM_HERE, std::string("Failed to decrypt encrypted node of type ") +
+ ModelTypeToString(GetModelType()));
return false;
}
password_data_.swap(data);
@@ -89,17 +92,14 @@ bool BaseNode::DecryptIfNecessary() {
std::string plaintext_data = GetTransaction()->GetCryptographer()->
DecryptToString(encrypted);
if (plaintext_data.length() == 0) {
- LOG(ERROR) << "Failed to decrypt encrypted node of type "
- << 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);
+ GetTransaction()->GetWrappedTrans()->OnUnrecoverableError(
+ FROM_HERE, std::string("Failed to decrypt encrypted node of type ") +
+ ModelTypeToString(GetModelType()));
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);
+ GetTransaction()->GetWrappedTrans()->OnUnrecoverableError(
+ FROM_HERE, std::string("Failed to parse encrypted node of type ") +
+ ModelTypeToString(GetModelType()));
return false;
}
DVLOG(2) << "Decrypted specifics of type "
« no previous file with comments | « no previous file | sync/internal_api/sync_encryption_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698