/ Check-in [db4e9728]
Login

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

Overview
Comment:Move two unreachable conditionals inside of NEVER() or assert().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: db4e9728fae5f7b0fad6aa0a5be317a7c9e7c417
User & Date: drh 2015-05-29 17:51:16
Context
2015-05-29
18:42
Ensure that allocateBtreePage() always clears the MemPage pointer when it fails due to an I/O or memory allocation error. check-in: 09a38bf6 user: drh tags: trunk
17:51
Move two unreachable conditionals inside of NEVER() or assert(). check-in: db4e9728 user: drh tags: trunk
17:13
Remove a corruption test in balance_nonroot that is superceded by a prior better check. check-in: 00693682 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  1331   1331     assert( gap<=65536 );
  1332   1332     /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size
  1333   1333     ** and the reserved space is zero (the usual value for reserved space)
  1334   1334     ** then the cell content offset of an empty page wants to be 65536.
  1335   1335     ** However, that integer is too large to be stored in a 2-byte unsigned
  1336   1336     ** integer, so a value of 0 is used in its place. */
  1337   1337     top = get2byteNotZero(&data[hdr+5]);
  1338         -  if( gap>top || (u32)top>pPage->pBt->usableSize ) return SQLITE_CORRUPT_BKPT;
         1338  +  if( gap>top || NEVER((u32)top>pPage->pBt->usableSize) ){
         1339  +    /* The NEVER() is because a oversize "top" value will be blocked from
         1340  +    ** reaching this point by btreeInitPage() or btreeGetUnusedPage() */
         1341  +    return SQLITE_CORRUPT_BKPT;
         1342  +  }
  1339   1343   
  1340   1344     /* If there is enough space between gap and top for one more cell pointer
  1341   1345     ** array entry offset, and if the freelist is not empty, then search the
  1342   1346     ** freelist looking for a free slot big enough to satisfy the request.
  1343   1347     */
  1344   1348     testcase( gap+2==top );
  1345   1349     testcase( gap+1==top );

Changes to src/tokenize.c.

   446    446           }
   447    447           break;
   448    448         }
   449    449       }
   450    450     }
   451    451   abort_parse:
   452    452     assert( nErr==0 );
   453         -  if( pParse->rc==SQLITE_OK && db->mallocFailed==0 && zSql[i]==0 ){
          453  +  if( pParse->rc==SQLITE_OK && db->mallocFailed==0 ){
          454  +    assert( zSql[i]==0 );
   454    455       if( lastTokenParsed!=TK_SEMI ){
   455    456         sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
   456    457         pParse->zTail = &zSql[i];
   457    458       }
   458    459       if( pParse->rc==SQLITE_OK && db->mallocFailed==0 ){
   459    460         sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
   460    461       }