SQLite

Check-in [f43e37e0a4]
Login

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

Overview
Comment:Avoid dereferencing a null pointer when doing a multi-database comment where one or more of the databases is an ATTACH-ed TEMP database. Ticket [abe728bbc311d].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f43e37e0a4cc7c15c996f4404dc775636396567d
User & Date: drh 2009-12-08 13:36:56.000
References
2009-12-08
13:46 Fixed ticket [abe728bbc3]: Crash committing multi-file transaction including temp file plus 3 other changes (artifact: bd0bb454b9 user: drh)
Context
2009-12-08
13:44
Add test cases for ticket [abe728bbc311]. (check-in: 4eb9bf0b93 user: drh tags: trunk)
13:36
Avoid dereferencing a null pointer when doing a multi-database comment where one or more of the databases is an ATTACH-ed TEMP database. Ticket [abe728bbc311d]. (check-in: f43e37e0a4 user: drh tags: trunk)
02:06
Add evidence marks for the abs() and soundex() SQL functions. (check-in: 003f3ed10c user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbeaux.c.
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711

1712

1713
1714
1715
1716
1717
1718
1719
    ** master journal file. If an error occurs at this point close
    ** and delete the master journal file. All the individual journal files
    ** still have 'null' as the master journal pointer, so they will roll
    ** back independently if a failure occurs.
    */
    for(i=0; i<db->nDb; i++){
      Btree *pBt = db->aDb[i].pBt;
      if( i==1 ) continue;   /* Ignore the TEMP database */
      if( sqlite3BtreeIsInTrans(pBt) ){
        char const *zFile = sqlite3BtreeGetJournalname(pBt);

        if( zFile[0]==0 ) continue;  /* Ignore :memory: databases */

        if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){
          needSync = 1;
        }
        rc = sqlite3OsWrite(pMaster, zFile, sqlite3Strlen30(zFile)+1, offset);
        offset += sqlite3Strlen30(zFile)+1;
        if( rc!=SQLITE_OK ){
          sqlite3OsCloseFree(pMaster);







<


>
|
>







1702
1703
1704
1705
1706
1707
1708

1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
    ** master journal file. If an error occurs at this point close
    ** and delete the master journal file. All the individual journal files
    ** still have 'null' as the master journal pointer, so they will roll
    ** back independently if a failure occurs.
    */
    for(i=0; i<db->nDb; i++){
      Btree *pBt = db->aDb[i].pBt;

      if( sqlite3BtreeIsInTrans(pBt) ){
        char const *zFile = sqlite3BtreeGetJournalname(pBt);
        if( zFile==0 || zFile[0]==0 ){
          continue;  /* Ignore TEMP and :memory: databases */
        }
        if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){
          needSync = 1;
        }
        rc = sqlite3OsWrite(pMaster, zFile, sqlite3Strlen30(zFile)+1, offset);
        offset += sqlite3Strlen30(zFile)+1;
        if( rc!=SQLITE_OK ){
          sqlite3OsCloseFree(pMaster);