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

Unified Diff: sync/syncable/directory_backing_store.cc

Issue 283143002: sync: Improve handling of bad UniquePos (retry) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « sync/syncable/directory.cc ('k') | sync/syncable/directory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory_backing_store.cc
diff --git a/sync/syncable/directory_backing_store.cc b/sync/syncable/directory_backing_store.cc
index ec28a53d661a47fcc9baaa99774301c01d953701..55a01e6c352830ee0f9d345c02c1f3c05b40f828 100644
--- a/sync/syncable/directory_backing_store.cc
+++ b/sync/syncable/directory_backing_store.cc
@@ -123,6 +123,16 @@ scoped_ptr<EntryKernel> UnpackEntry(sql::Statement* statement) {
kernel->mutable_ref(static_cast<AttachmentMetadataField>(i)).ParseFromArray(
statement->ColumnBlob(i), statement->ColumnByteLength(i));
}
+
+ // Sanity check on positions. We risk strange and rare crashes if our
+ // assumptions about unique position values are broken.
+ if (kernel->ShouldMaintainPosition() &&
+ !kernel->ref(UNIQUE_POSITION).IsValid()) {
+ DVLOG(1) << "Unpacked invalid position on an entity that should have a "
+ << "valid position. Assuming the DB is corrupt.";
+ return scoped_ptr<EntryKernel>();
+ }
+
return kernel.Pass();
}
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/syncable/directory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698