[tracker/binary-log-2: 38/56] Fixed journal crc check failure
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/binary-log-2: 38/56] Fixed journal crc check failure
- Date: Fri, 8 Jan 2010 10:35:45 +0000 (UTC)
commit b3a4055ef97eaee2a159c1339fa98eecb8836c95
Author: Martyn Russell <martyn lanedo com>
Date: Wed Jan 6 10:40:48 2010 +0000
Fixed journal crc check failure
src/libtracker-db/tracker-db-journal.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index 5de39ab..3fafd01 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -649,7 +649,8 @@ tracker_db_journal_reader_next (GError **error)
/* Expect new transaction or end of file */
guint32 entry_size;
guint32 entry_size_check;
- guint32 crc32;
+ guint32 crc;
+ guint32 crc_check;
/* Check the end is not before where we currently are */
if (reader.current >= reader.end) {
@@ -672,7 +673,7 @@ tracker_db_journal_reader_next (GError **error)
entry_size = read_uint32 (reader.current);
/* Set the bounds for the entry */
- reader.entry_begin = reader.current;
+ reader.entry_begin = reader.current + (sizeof (guint32) * 3);
reader.entry_end = reader.entry_begin + entry_size;
/* Check the end of the entry does not exceed the end
@@ -689,7 +690,7 @@ tracker_db_journal_reader_next (GError **error)
*/
reader.current += 4;
- /* compare with entry_size at end */
+ /* Read entry size check at the end of the entry */
entry_size_check = read_uint32 (reader.entry_end - 4);
if (entry_size != entry_size_check) {
@@ -701,17 +702,24 @@ tracker_db_journal_reader_next (GError **error)
return FALSE;
}
+ /* Read the amount of triples */
reader.amount_of_triples = read_uint32 (reader.current);
reader.current += 4;
- crc32 = read_uint32 (reader.current);
+ /* Read the crc */
+ crc_check = read_uint32 (reader.current);
reader.current += 4;
- /* verify checksum */
- if (crc32 != tracker_crc32 (reader.entry_begin, entry_size)) {
+ /* Calculate the crc */
+ crc = tracker_crc32 (reader.entry_begin, entry_size);
+
+ /* Verify checksum */
+ if (crc != crc_check) {
/* damaged journal entry */
g_set_error (error, TRACKER_DB_JOURNAL_ERROR, 0,
- "Damaged journal entry, crc32 failed");
+ "Damaged journal entry, 0x%.8x != 0x%.8x (crc32 failed)",
+ crc,
+ crc_check);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]