Skip to content

Commit c6bf239

Browse files
committed
cipher_integrity check will report expected page size if invalid
1 parent 45a2059 commit c6bf239

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/crypto_impl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ int sqlcipher_codec_ctx_integrity_check(codec_ctx *ctx, Parse *pParse, char *col
13911391
}
13921392

13931393
if(file_sz % ctx->page_sz != 0) {
1394-
result = sqlite3_mprintf("page %d has an invalid size of %lld bytes", page, file_sz - ((file_sz / ctx->page_sz) * ctx->page_sz));
1394+
result = sqlite3_mprintf("page %d has an invalid size of %lld bytes (expected %d bytes)", page, file_sz - ((file_sz / ctx->page_sz) * ctx->page_sz), ctx->page_sz);
13951395
sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, result, P4_DYNAMIC);
13961396
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
13971397
}

test/sqlcipher-integrity.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ do_test version-4-integrity-check-invalid-last-page {
310310
PRAGMA key = 'testkey';
311311
PRAGMA cipher_integrity_check;
312312
}
313-
} {ok {page 240 has an invalid size of 2 bytes}}
313+
} {ok {page 240 has an invalid size of 2 bytes (expected 4096 bytes)}}
314314
db close
315315
file delete -force test.db
316316

0 commit comments

Comments
 (0)