1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

The BTree mutex must be held when calling sqlite3BtreeLastPage(). This

check-in fixes a bug introduced by [cf8b99e17872c054].

FossilOrigin-Name: e6c30ee52c5cdc193804cec63374d558b45e4d67fc6bde58771ca78485ca0acf
This commit is contained in:
drh
2024-12-19 19:02:09 +00:00
parent f2d422c528
commit be2a40d489
3 changed files with 9 additions and 7 deletions

View File

@ -428,9 +428,11 @@ static int dbpageSync(sqlite3_vtab *pVtab){
if( pTab->pgnoTrunc>0 ){
Btree *pBt = pTab->db->aDb[pTab->iDbTrunc].pBt;
Pager *pPager = sqlite3BtreePager(pBt);
sqlite3BtreeEnter(pBt);
if( pTab->pgnoTrunc<sqlite3BtreeLastPage(pBt) ){
sqlite3PagerTruncateImage(pPager, pTab->pgnoTrunc);
}
sqlite3BtreeLeave(pBt);
}
pTab->pgnoTrunc = 0;
return SQLITE_OK;