/ Check-in [54bf048119]
Login

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

Overview
Comment:Remove an ALWAYS on a branch for improved database corruption detection in btree.c:freeSpace(). Test case found by dbsqlfuzz.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 54bf04811951db6c894f272f870e3e41f8f5e05a25c1115efbbdbd0d8bba54be
User & Date: drh 2020-01-14 16:39:54
Context
2020-01-14
16:50
Fix the urifuncs.c extension (used for testing and debugging only) so that the sqlite3_filename_database() SQL function and its siblings correctly handle an invalid schema name passed in as the argument. check-in: 3d7434a9d8 user: drh tags: trunk
16:39
Remove an ALWAYS on a branch for improved database corruption detection in btree.c:freeSpace(). Test case found by dbsqlfuzz. check-in: 54bf048119 user: drh tags: trunk
16:33
Add the new noop_nd() debugging function to the noop.c extension. check-in: 72911fb1b0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
  hdr = pPage->hdrOffset;
  iPtr = hdr + 1;
  if( data[iPtr+1]==0 && data[iPtr]==0 ){
    iFreeBlk = 0;  /* Shortcut for the case when the freelist is empty */
  }else{
    while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
      if( iFreeBlk<iPtr+4 ){
        if( ALWAYS(iFreeBlk==0) ) break;
        return SQLITE_CORRUPT_PAGE(pPage);
      }
      iPtr = iFreeBlk;
    }
    if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */
      return SQLITE_CORRUPT_PAGE(pPage);
    }







|







1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
  hdr = pPage->hdrOffset;
  iPtr = hdr + 1;
  if( data[iPtr+1]==0 && data[iPtr]==0 ){
    iFreeBlk = 0;  /* Shortcut for the case when the freelist is empty */
  }else{
    while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
      if( iFreeBlk<iPtr+4 ){
        if( iFreeBlk==0 ) break; /* TH3: corrupt082.100 */
        return SQLITE_CORRUPT_PAGE(pPage);
      }
      iPtr = iFreeBlk;
    }
    if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */
      return SQLITE_CORRUPT_PAGE(pPage);
    }

Changes to test/fuzzdata8.db.

cannot compute difference between binary files