mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Add a test to ensure that the app-defined pcache xFetch() method is never
passed a key of zero. FossilOrigin-Name: 0bdbe49c6d392c4c86a6c01219c9d91d150dea7d
This commit is contained in:
@@ -5373,6 +5373,7 @@ static int getPageNormal(
|
||||
assert( assert_pager_state(pPager) );
|
||||
assert( pPager->hasHeldSharedLock==1 );
|
||||
|
||||
if( pgno==0 ) return SQLITE_CORRUPT_BKPT;
|
||||
pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3);
|
||||
if( pBase==0 ){
|
||||
pPg = 0;
|
||||
@@ -5400,11 +5401,10 @@ static int getPageNormal(
|
||||
/* The pager cache has created a new page. Its content needs to
|
||||
** be initialized. But first some error checks:
|
||||
**
|
||||
** (1) Minimum page number is 1
|
||||
** (2) The maximum page number is 2^31
|
||||
** (3) Never try to fetch the locking page
|
||||
** (1) The maximum page number is 2^31
|
||||
** (2) Never try to fetch the locking page
|
||||
*/
|
||||
if( pgno==0 || pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
|
||||
if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto pager_acquire_err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user