summaryrefslogtreecommitdiff
path: root/src/journal/journal-verify.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-18 01:45:39 +0200
committerLennart Poettering <lennart@poettering.net>2012-08-18 01:45:39 +0200
commitfb9a24b6b1ed5b1f42e6e350ccdb7e11800a83bd (patch)
treec71c7fc28c6bf938d009123ee425e5be248fd4e7 /src/journal/journal-verify.c
parent97147f8c1f63234470a7062d2ed0f999c0996d42 (diff)
journal: even more simple static object tests
Diffstat (limited to 'src/journal/journal-verify.c')
-rw-r--r--src/journal/journal-verify.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index e3bd8ffbd7..a31817671b 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -134,6 +134,19 @@ static int journal_file_object_verify(JournalFile *f, Object *o) {
if ((le64toh(o->object.size) - offsetof(HashTableObject, items)) / sizeof(HashItem) <= 0)
return -EBADMSG;
+ for (i = 0; i < journal_file_hash_table_n_items(o); i++) {
+ if (o->hash_table.items[i].head_hash_offset != 0 &&
+ !VALID64(le64toh(o->hash_table.items[i].head_hash_offset)))
+ return -EBADMSG;
+ if (o->hash_table.items[i].tail_hash_offset != 0 &&
+ !VALID64(le64toh(o->hash_table.items[i].tail_hash_offset)))
+ return -EBADMSG;
+
+ if ((o->hash_table.items[i].head_hash_offset != 0) !=
+ (o->hash_table.items[i].tail_hash_offset != 0))
+ return -EBADMSG;
+ }
+
break;
case OBJECT_ENTRY_ARRAY:
@@ -146,6 +159,11 @@ static int journal_file_object_verify(JournalFile *f, Object *o) {
if (!VALID64(o->entry_array.next_entry_array_offset))
return -EBADMSG;
+ for (i = 0; i < journal_file_entry_array_n_items(o); i++)
+ if (o->entry_array.items[i] != 0 &&
+ !VALID64(o->entry_array.items[i]))
+ return -EBADMSG;
+
break;
case OBJECT_TAG: