1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Added comments and testcase() macros to error cases in the btree search.

FossilOrigin-Name: 7da7dc714bf1fe34b38fc33a923490dfd3e4f070
This commit is contained in:
drh
2015-05-28 15:14:32 +00:00
parent 73d340adff
commit c68275032e
3 changed files with 12 additions and 9 deletions

View File

@@ -4943,7 +4943,7 @@ int sqlite3BtreeMovetoUnpacked(
}
}else{
for(;;){
int nCell;
int nCell; /* Size of the pCell cell in bytes */
pCell = findCell(pPage, idx) + pPage->childPtrSize;
/* The maximum supported page-size is 65536 bytes. This means that
@@ -4982,7 +4982,10 @@ int sqlite3BtreeMovetoUnpacked(
u8 * const pCellBody = pCell - pPage->childPtrSize;
btreeParseCellPtr(pPage, pCellBody, &pCur->info);
nCell = (int)pCur->info.nKey;
testcase( nCell<0 );
testcase( nCell<0 ); /* True if key size is 2^32 or more */
testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */
testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */
testcase( nCell==2 ); /* Minimum legal index key size */
if( nCell<2 ){
rc = SQLITE_CORRUPT_BKPT;
goto moveto_finish;