/ Check-in [3036fd71]
Login

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

Overview
Comment:Detect when an attempt is made to write to a pointer map page that is also being used as a btree page and report corruption.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fuzzcheck-fix
Files: files | file ages | folders
SHA3-256:3036fd71ac7063359b04a0ed54a6c63a380eb7ff75cd29ed27486d4259066aee
User & Date: drh 2018-12-14 03:14:18
Context
2018-12-14
03:16
Report corruption when an attempt is made to write a pointer-map page that is also being used as a btree page. Also, fix a bug in fuzzcheck that cause it to overlook a pointer-map bug that was trigger by the fuzzcheck test data, and also fix the pointer-map bug. check-in: cc42dd15 user: drh tags: trunk
03:14
Detect when an attempt is made to write to a pointer map page that is also being used as a btree page and report corruption. Closed-Leaf check-in: 3036fd71 user: drh tags: fuzzcheck-fix
02:29
Fix a bug in the custom in-memory VFS used by fuzzcheck. This bug masks other bugs that should have caused some existing fuzzdata7.db entries to fail, and so this fix is initially on a branch until those other bugs can be repaired. check-in: e0994e99 user: drh tags: fuzzcheck-fix
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

987
988
989
990
991
992
993







994
995
996
997
998
999
1000
    return;
  }
  iPtrmap = PTRMAP_PAGENO(pBt, key);
  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0);
  if( rc!=SQLITE_OK ){
    *pRC = rc;
    return;







  }
  offset = PTRMAP_PTROFFSET(iPtrmap, key);
  if( offset<0 ){
    *pRC = SQLITE_CORRUPT_BKPT;
    goto ptrmap_exit;
  }
  assert( offset <= (int)pBt->usableSize-5 );







>
>
>
>
>
>
>







987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
    return;
  }
  iPtrmap = PTRMAP_PAGENO(pBt, key);
  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0);
  if( rc!=SQLITE_OK ){
    *pRC = rc;
    return;
  }
  if( ((char*)sqlite3PagerGetExtra(pDbPage))[0]!=0 ){
    /* The first byte of the extra data is the MemPage.isInit byte.
    ** If that byte is set, it means this page is also being used
    ** as a btree page. */
    *pRC = SQLITE_CORRUPT_BKPT;
    goto ptrmap_exit;
  }
  offset = PTRMAP_PTROFFSET(iPtrmap, key);
  if( offset<0 ){
    *pRC = SQLITE_CORRUPT_BKPT;
    goto ptrmap_exit;
  }
  assert( offset <= (int)pBt->usableSize-5 );