1
0
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:
drh
2016-12-30 14:25:42 +00:00
parent 895decf6b5
commit 5f4ade0473
3 changed files with 12 additions and 12 deletions

View File

@@ -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;
}