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

Convert an assert() into a corruption detection branch in

sqlite3BtreePayload().  dbsqlfuzz 848171b5d58f6e4a62257466e0e7de16696d4f02.

FossilOrigin-Name: f038d7f90e04838479e44ded00f627ec5ad8e1bd477edea8e87e66dd37485f30
This commit is contained in:
drh
2021-10-13 20:11:30 +00:00
parent c380f79112
commit a71490889e
3 changed files with 10 additions and 9 deletions

View File

@@ -4836,7 +4836,9 @@ static int accessPayload(
assert( pPage );
assert( eOp==0 || eOp==1 );
assert( pCur->eState==CURSOR_VALID );
assert( pCur->ix<pPage->nCell );
if( pCur->ix>=pPage->nCell ){
return SQLITE_CORRUPT_PAGE(pPage);
}
assert( cursorHoldsMutex(pCur) );
getCellInfo(pCur);
@@ -5023,7 +5025,6 @@ int sqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
assert( cursorHoldsMutex(pCur) );
assert( pCur->eState==CURSOR_VALID );
assert( pCur->iPage>=0 && pCur->pPage );
assert( pCur->ix<pCur->pPage->nCell );
return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);
}