summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-04 17:22:29 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-04 17:22:29 +0000
commit06ce8802ca1cc98e5e62ec17e4a812e0c9794509 (patch)
tree8f78532b6e86430eb40b863a8ab25d4b009f16cd /third_party
parentf0733f1de014f04da70a26899cb430fc73e4f4d9 (diff)
downloadchromium_src-06ce8802ca1cc98e5e62ec17e4a812e0c9794509.zip
chromium_src-06ce8802ca1cc98e5e62ec17e4a812e0c9794509.tar.gz
chromium_src-06ce8802ca1cc98e5e62ec17e4a812e0c9794509.tar.bz2
Only do the exclude-journal-from-Time-Machine-if-the-database-is-excluded
thing for unix-flavored sqlite3 VFSes. It's wrong to try to do this for the chromium_vfs sqlite3 VFS type. The exclude code should only be used for databases that are actually on disk. Under chromium_vfs, zFilename is a name but not a filesystem pathname, and in the Chromium renderer process, direct filesystem access is forbidden. The resulting CFURLRef objects did not have valid referents, and on Mac OS X 10.7 ("Lion"), they resulted in use-after-free and double-free errors. BUG=91068 TEST=With a clean profile, visit http://www.justgiving.nl/. The page should not sad tab. Nothing should be logged to the console. Previously, messages such as the following would be logged: Google Chrome Helper(12345,0xabcdef00) malloc: *** error for object 0x4545450: incorrect checksum for freed object - object was probably modified after being freed. Google Chrome Helper(12345,0xabcdef00) malloc: *** error for object 0x4545450: double free Review URL: http://codereview.chromium.org/7511011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/sqlite/README.chromium14
-rw-r--r--third_party/sqlite/amalgamation/sqlite3.c7
-rw-r--r--third_party/sqlite/mac_time_machine.patch9
-rw-r--r--third_party/sqlite/src/src/pager.c7
4 files changed, 23 insertions, 14 deletions
diff --git a/third_party/sqlite/README.chromium b/third_party/sqlite/README.chromium
index a38ffda..dd729b8 100644
--- a/third_party/sqlite/README.chromium
+++ b/third_party/sqlite/README.chromium
@@ -179,11 +179,11 @@ Changes from Chrome:
fillInUnixFile(), which will be made static again as soon as a
WebKit patch using the new function lands.
- From mac_time_machine.patch:
- When __APPLE__ and when creating a -journal file, determine if the database
- for which the journal is being created has been excluded from being backed
- up using Apple's Time Machine and if so then also exclude the journal. These
- changes were made in pager.c with includes of Apple interfaces being made in
- sqliteInt.h. In order to eliminate a symbol conflict with an Apple library
- after amalgamation it was also necessary to rename fts3_porter.c's 'cType'
- to 'vOrCType'.
+ When __APPLE__ and when creating a -journal file with any unix-type vfs,
+ determine if the database for which the journal is being created has been
+ excluded from being backed up using Apple's Time Machine and if so then also
+ exclude the journal. These changes were made in pager.c with includes of
+ Apple interfaces being made in sqliteInt.h. In order to eliminate a symbol
+ conflict with an Apple library after amalgamation it was also necessary to
+ rename fts3_porter.c's 'cType' to 'vOrCType'.
- fts3_85522.patch allows fts3 to work if PRAGMA is not authorized.
diff --git a/third_party/sqlite/amalgamation/sqlite3.c b/third_party/sqlite/amalgamation/sqlite3.c
index 6213b43..5115f81 100644
--- a/third_party/sqlite/amalgamation/sqlite3.c
+++ b/third_party/sqlite/amalgamation/sqlite3.c
@@ -41636,9 +41636,12 @@ static int pager_open_journal(Pager *pPager){
#endif
#if defined(__APPLE__)
/* Set the TimeMachine exclusion metadata for the journal if it has
- ** been set for the database. */
+ ** been set for the database. Only do this for unix-type vfs
+ ** implementations. */
if( rc==SQLITE_OK && pPager->zFilename!=NULL
- && strlen(pPager->zFilename)>0 ){
+ && strlen(pPager->zFilename)>0
+ && memcmp(pVfs->zName, "unix", 4)==0
+ && ( pVfs->zName[4]=='-' || pVfs->zName[4]=='\0' ) ){
CFURLRef database = create_cfurl_from_cstring(pPager->zFilename);
if( CSBackupIsItemExcluded(database, NULL) ){
CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal);
diff --git a/third_party/sqlite/mac_time_machine.patch b/third_party/sqlite/mac_time_machine.patch
index d841c16..905609e 100644
--- a/third_party/sqlite/mac_time_machine.patch
+++ b/third_party/sqlite/mac_time_machine.patch
@@ -45,15 +45,18 @@ Index: src/pager.c
** This function is called at the start of every write transaction.
** There must already be a RESERVED or EXCLUSIVE lock on the database
** file when this routine is called.
-@@ -5189,6 +5203,21 @@
+@@ -5189,6 +5203,24 @@
#else
rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);
#endif
+#if defined(__APPLE__)
+ /* Set the TimeMachine exclusion metadata for the journal if it has
-+ ** been set for the database. */
++ ** been set for the database. Only do this for unix-type vfs
++ ** implementations. */
+ if( rc==SQLITE_OK && pPager->zFilename!=NULL
-+ && strlen(pPager->zFilename)>0 ){
++ && strlen(pPager->zFilename)>0
++ && memcmp(pVfs->zName, "unix", 4)==0
++ && ( pVfs->zName[4]=='-' || pVfs->zName[4]=='\0' ) ){
+ CFURLRef database = create_cfurl_from_cstring(pPager->zFilename);
+ if( CSBackupIsItemExcluded(database, NULL) ){
+ CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal);
diff --git a/third_party/sqlite/src/src/pager.c b/third_party/sqlite/src/src/pager.c
index 8bdcac8c..8cd31a9 100644
--- a/third_party/sqlite/src/src/pager.c
+++ b/third_party/sqlite/src/src/pager.c
@@ -5205,9 +5205,12 @@ static int pager_open_journal(Pager *pPager){
#endif
#if defined(__APPLE__)
/* Set the TimeMachine exclusion metadata for the journal if it has
- ** been set for the database. */
+ ** been set for the database. Only do this for unix-type vfs
+ ** implementations. */
if( rc==SQLITE_OK && pPager->zFilename!=NULL
- && strlen(pPager->zFilename)>0 ){
+ && strlen(pPager->zFilename)>0
+ && memcmp(pVfs->zName, "unix", 4)==0
+ && ( pVfs->zName[4]=='-' || pVfs->zName[4]=='\0' ) ){
CFURLRef database = create_cfurl_from_cstring(pPager->zFilename);
if( CSBackupIsItemExcluded(database, NULL) ){
CFURLRef journal = create_cfurl_from_cstring(pPager->zJournal);