/ Check-in [7cacf4e9]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Use SQLITE_WITHIN() for pointer range comparisons in some testing code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7cacf4e954c8de5af5efb56d8271a5ac1edc1c04
User & Date: drh 2016-04-05 13:35:43
Context
2016-04-05
14:01
Remove an unnecessary conditional from the index builder. check-in: 87e5f5a6 user: drh tags: trunk
13:35
Use SQLITE_WITHIN() for pointer range comparisons in some testing code. check-in: 7cacf4e9 user: drh tags: trunk
13:19
Do not allow pointer arithmetic to move a pointer across a memory allocation boundary. check-in: 85b97931 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  6704   6704     put2byte(&aData[hdr+3], pPg->nCell);
  6705   6705     put2byte(&aData[hdr+5], pData - aData);
  6706   6706   
  6707   6707   #ifdef SQLITE_DEBUG
  6708   6708     for(i=0; i<nNew && !CORRUPT_DB; i++){
  6709   6709       u8 *pCell = pCArray->apCell[i+iNew];
  6710   6710       int iOff = get2byteAligned(&pPg->aCellIdx[i*2]);
  6711         -    if( pCell>=aData && pCell<&aData[pPg->pBt->usableSize] ){
         6711  +    if( SQLITE_WITHIN(pCell, aData, &aData[pPg->pBt->usableSize]) ){
  6712   6712         pCell = &pTmp[pCell - aData];
  6713   6713       }
  6714   6714       assert( 0==memcmp(pCell, &aData[iOff],
  6715   6715               pCArray->pRef->xCellSize(pCArray->pRef, pCArray->apCell[i+iNew])) );
  6716   6716     }
  6717   6717   #endif
  6718   6718