Index: sync/internal_api/attachments/on_disk_attachment_store.cc |
diff --git a/sync/internal_api/attachments/on_disk_attachment_store.cc b/sync/internal_api/attachments/on_disk_attachment_store.cc |
index ec6fc75931bd9283d50033f4b055f9f52f514717..699e1f5add122106a7f7030881e3c9731d295c2d 100644 |
--- a/sync/internal_api/attachments/on_disk_attachment_store.cc |
+++ b/sync/internal_api/attachments/on_disk_attachment_store.cc |
@@ -319,12 +319,18 @@ scoped_ptr<Attachment> OnDiskAttachmentStore::ReadSingleAttachment( |
scoped_refptr<base::RefCountedMemory> data = |
base::RefCountedString::TakeString(&data_str); |
uint32_t crc32c = ComputeCrc32c(data); |
- if (record_metadata.has_crc32c() && record_metadata.crc32c() != crc32c) { |
- DVLOG(1) << "Attachment crc does not match"; |
- return attachment.Pass(); |
+ if (record_metadata.has_crc32c()) { |
+ if (record_metadata.crc32c() != crc32c) { |
+ DVLOG(1) << "Attachment crc32c does not match value read from store"; |
+ return attachment.Pass(); |
+ } |
+ if (record_metadata.crc32c() != attachment_id.GetCrc32c()) { |
+ DVLOG(1) << "Attachment crc32c does not match value in AttachmentId"; |
+ return attachment.Pass(); |
+ } |
} |
attachment.reset( |
- new Attachment(Attachment::CreateFromParts(attachment_id, data, crc32c))); |
+ new Attachment(Attachment::CreateFromParts(attachment_id, data))); |
return attachment.Pass(); |
} |