From 1bf4d0347b44f08a12dd902b2ec35bc481d65ebd Mon Sep 17 00:00:00 2001 From: Harveer Singh Date: Tue, 3 Dec 2024 17:51:00 +0000 Subject: [PATCH] Bug 1878311: Sync obfsDeviceCharacteristics method with sqlite obfsvfs.c.r=dom-storage-reviewers,janv This change seeks to sync the changes in sqlite's obfsvfs.c, specifically in method obfsDeviceCharacteristics. This fixes the issue where SQLITE_DIRECT_OVEFLOW_READ option was causing issues for non-standard VFSes. Sqlite has fixed this issue in 3.47.1 release by introducing SQLITE_IOCAP_SUBPAGE_READ flag, which allows VFS to signal that it cannot handle unaligned reads. Differential Revision: https://phabricator.services.mozilla.com/D230671 --- storage/ObfuscatingVFS.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/ObfuscatingVFS.cpp b/storage/ObfuscatingVFS.cpp index 107384376c41..2eb6aee4012d 100644 --- a/storage/ObfuscatingVFS.cpp +++ b/storage/ObfuscatingVFS.cpp @@ -445,8 +445,11 @@ static int obfsSectorSize(sqlite3_file* pFile) { ** Return the device characteristic flags supported by an obfuscated file. */ static int obfsDeviceCharacteristics(sqlite3_file* pFile) { + int dc; pFile = ORIGFILE(pFile); - return pFile->pMethods->xDeviceCharacteristics(pFile); + dc = pFile->pMethods->xDeviceCharacteristics(pFile); + return dc & ~SQLITE_IOCAP_SUBPAGE_READ; /* All except the + SQLITE_IOCAP_SUBPAGE_READ bit */ } /* Create a shared memory file mapping */