mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Add coverage test cases. Have sqlite3_backup_step() transform SQLITE_IOERR_NOMEM to SQLITE_NOMEM before returning.
FossilOrigin-Name: 5e19bc360e098ec06a72f4a86254d8e62e93ea57
This commit is contained in:
20
src/btree.c
20
src/btree.c
@@ -1585,16 +1585,20 @@ static int getAndInitPage(
|
||||
int rc;
|
||||
assert( sqlite3_mutex_held(pBt->mutex) );
|
||||
|
||||
if( pgno<=0 || pgno>btreePagecount(pBt) ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
rc = btreeGetPage(pBt, pgno, ppPage, 0);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = btreeInitPage(*ppPage);
|
||||
if( rc!=SQLITE_OK ){
|
||||
releasePage(*ppPage);
|
||||
if( pgno>btreePagecount(pBt) ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
}else{
|
||||
rc = btreeGetPage(pBt, pgno, ppPage, 0);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = btreeInitPage(*ppPage);
|
||||
if( rc!=SQLITE_OK ){
|
||||
releasePage(*ppPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testcase( pgno==0 );
|
||||
assert( pgno!=0 || rc==SQLITE_CORRUPT );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user