/ Check-in [55ec474d]
Login

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

Overview
Comment:Detect a corrupt UnpackedRecord and return SQLITE_CORRUPT prior to calling sqlite3BtreeMovetoUnpacked().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 55ec474db8935ef36fae30da5d11f5701c60c088
User & Date: drh 2013-11-30 12:49:28
Context
2013-12-01
01:18
Fix typos in the header comment on the sqlite3Atoi64() routine. check-in: c85e0c54 user: drh tags: trunk
2013-11-30
12:49
Detect a corrupt UnpackedRecord and return SQLITE_CORRUPT prior to calling sqlite3BtreeMovetoUnpacked(). check-in: 55ec474d user: drh tags: trunk
2013-11-29
15:39
Change the name of the CORRUPTIBLE macro to CORRUPT_DB. check-in: f865be10 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

690
691
692
693
694
695
696




697
698
699
700
701
702
703
  if( pKey ){
    assert( nKey==(i64)(int)nKey );
    pIdxKey = sqlite3VdbeAllocUnpackedRecord(
        pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
    );
    if( pIdxKey==0 ) return SQLITE_NOMEM;
    sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey);




  }else{
    pIdxKey = 0;
  }
  rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);
  if( pFree ){
    sqlite3DbFree(pCur->pKeyInfo->db, pFree);
  }







>
>
>
>







690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
  if( pKey ){
    assert( nKey==(i64)(int)nKey );
    pIdxKey = sqlite3VdbeAllocUnpackedRecord(
        pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree
    );
    if( pIdxKey==0 ) return SQLITE_NOMEM;
    sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey);
    if( pIdxKey->nField==0 ){
      sqlite3DbFree(pCur->pKeyInfo->db, pFree);
      return SQLITE_CORRUPT_BKPT;
    }
  }else{
    pIdxKey = 0;
  }
  rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);
  if( pFree ){
    sqlite3DbFree(pCur->pKeyInfo->db, pFree);
  }