SQLite

Check-in [f73cc0e9af]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a segfault that is possible for an OOM fault in ATTACH when in shared-cache mode. This is a cherrypick merge of check-in [e37137376a].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | branch-3.6.22
Files: files | file ages | folders
SHA1: f73cc0e9af5e4b7a15e8947c412966f9e9935f8b
User & Date: drh 2010-02-25 02:11:22.000
Context
2010-02-25
02:32
Merge in all of the logging enhancements. This is a cherrypick merge of the following check-ins: [103321e37a], [a8076aede3], [6d910245ad], [7c4cca6d1a], [edea3bb740], [1a6d4bb130], [a8c984c1d6], [69a493182f], and [1168763d2c]. (check-in: 46f406b202 user: drh tags: branch-3.6.22)
02:11
Fix a segfault that is possible for an OOM fault in ATTACH when in shared-cache mode. This is a cherrypick merge of check-in [e37137376a]. (check-in: f73cc0e9af user: drh tags: branch-3.6.22)
02:04
Enhance integrity_check to detect out-of-order rowids. This is a cherrypick merge of check-in [cae47c5b09]. (check-in: ecd22ef34d user: drh tags: branch-3.6.22)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/attach.c.
141
142
143
144
145
146
147

148



149
150
151
152
153
154
155
156
        "attached databases must use the same text encoding as main database");
      rc = SQLITE_ERROR;
    }
    pPager = sqlite3BtreePager(aNew->pBt);
    sqlite3PagerLockingMode(pPager, db->dfltLockMode);
    sqlite3PagerJournalMode(pPager, db->dfltJournalMode);
  }

  aNew->zName = sqlite3DbStrDup(db, zName);



  aNew->safety_level = 3;

#if SQLITE_HAS_CODEC
  if( rc==SQLITE_OK ){
    extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);
    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
    int nKey;
    char *zKey;







>

>
>
>
|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
        "attached databases must use the same text encoding as main database");
      rc = SQLITE_ERROR;
    }
    pPager = sqlite3BtreePager(aNew->pBt);
    sqlite3PagerLockingMode(pPager, db->dfltLockMode);
    sqlite3PagerJournalMode(pPager, db->dfltJournalMode);
  }
  aNew->safety_level = 3;
  aNew->zName = sqlite3DbStrDup(db, zName);
  if( rc==SQLITE_OK && aNew->zName==0 ){
    rc = SQLITE_NOMEM;
  }


#if SQLITE_HAS_CODEC
  if( rc==SQLITE_OK ){
    extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);
    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
    int nKey;
    char *zKey;
Changes to test/attachmalloc.test.
55
56
57
58
59
60
61













62
63
    CREATE INDEX i1 ON t1(a, b);
  }
  db2 close
} -sqlbody {
  CREATE TABLE t1(d, e, f);
  ATTACH 'test2.db' AS db1;
}














finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    CREATE INDEX i1 ON t1(a, b);
  }
  db2 close
} -sqlbody {
  CREATE TABLE t1(d, e, f);
  ATTACH 'test2.db' AS db1;
}

set enable_shared_cache [sqlite3_enable_shared_cache 1]
sqlite3 dbaux test2.db
dbaux eval {SELECT * FROM sqlite_master}
do_malloc_test attachmalloc-3 -sqlbody {
  SELECT * FROM sqlite_master;
  ATTACH 'test2.db' AS two;
} -cleanup {
  db eval { DETACH two }
}
dbaux close
sqlite3_enable_shared_cache $enable_shared_cache


finish_test