From b4a88cfcd0bb50fee1c477c45a0f638d8b1b2372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Tro=C3=9Fbach?= Date: Wed, 16 Sep 2026 08:01:23 +0200 Subject: [PATCH] Do not drop read errors of the real file mcIoRead returned early only for SQLITE_IOERR_SHORT_READ. Every other error of the real file fell through to the handler of the file type, where rc is initialised with SQLITE_OK and then overwritten, so a failed read was reported as success and SQLite used the buffer as it was. For files that have no codec, a statement journal for example, this always happened. A read error while rolling back to a savepoint could therefore put page images that were never read into the main database. Return every error of the real file right away. --- src/sqlite3mc_vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sqlite3mc_vfs.c b/src/sqlite3mc_vfs.c index 3adedeb0..9ad35f4e 100644 --- a/src/sqlite3mc_vfs.c +++ b/src/sqlite3mc_vfs.c @@ -816,7 +816,7 @@ static int mcIoRead(sqlite3_file* pFile, void* buffer, int count, sqlite3_int64 { sqlite3mc_file* mcFile = (sqlite3mc_file*) pFile; int rc = REALFILE(pFile)->pMethods->xRead(REALFILE(pFile), buffer, count, offset); - if (rc == SQLITE_IOERR_SHORT_READ) + if (rc != SQLITE_OK) { return rc; }