Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: third_party/sqlite/patches/0010-Allow-read-only-memory-mapping.patch

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/patches/0010-Allow-read-only-memory-mapping.patch
diff --git a/third_party/sqlite/patches/0010-Allow-read-only-memory-mapping.patch b/third_party/sqlite/patches/0010-Allow-read-only-memory-mapping.patch
new file mode 100644
index 0000000000000000000000000000000000000000..3653fb9540abf08a500606d729ebe54e63559d35
--- /dev/null
+++ b/third_party/sqlite/patches/0010-Allow-read-only-memory-mapping.patch
@@ -0,0 +1,47 @@
+From 12b0ba774b11ae27c41ad20e62522c00567e2a0a Mon Sep 17 00:00:00 2001
+From: Scott Hess <shess@chromium.org>
+Date: Wed, 5 Aug 2015 16:44:32 -0700
+Subject: [PATCH 10/10] Allow read-only memory mapping.
+
+In memory-mapped I/O mode, SQLite writes pages by using memcpy() from
+the staging memory into the underlying memory-mapped file. This allows
+anyone in the process to also write into that space. Modify SQLite to
+map things read-only.
+
+TODO: Upstream.
+
+BUG=489784
+---
+ third_party/sqlite/src/src/os_unix.c | 2 +-
+ third_party/sqlite/src/src/os_win.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/third_party/sqlite/src/src/os_unix.c b/third_party/sqlite/src/src/os_unix.c
+index fa85638..523cad6 100644
+--- a/third_party/sqlite/src/src/os_unix.c
++++ b/third_party/sqlite/src/src/os_unix.c
+@@ -3141,7 +3141,7 @@ static int unixRead(
+ );
+ #endif
+
+-#if SQLITE_MAX_MMAP_SIZE>0
++#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0
+ /* Deal with as much of this read request as possible by transfering
+ ** data from the memory mapping using memcpy(). */
+ if( offset<pFile->mmapSize ){
+diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os_win.c
+index 00ad6fd..8a68828 100644
+--- a/third_party/sqlite/src/src/os_win.c
++++ b/third_party/sqlite/src/src/os_win.c
+@@ -2524,7 +2524,7 @@ static int winRead(
+ "offset=%lld, lock=%d\n", osGetCurrentProcessId(), pFile,
+ pFile->h, pBuf, amt, offset, pFile->locktype));
+
+-#if SQLITE_MAX_MMAP_SIZE>0
++#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0
+ /* Deal with as much of this read request as possible by transfering
+ ** data from the memory mapping using memcpy(). */
+ if( offset<pFile->mmapSize ){
+--
+2.7.0
+

Powered by Google App Engine
This is Rietveld 408576698