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

Detect when an attempt is made to write to a pointer map page that is also

being used as a btree page and report corruption.

FossilOrigin-Name: 3036fd71ac7063359b04a0ed54a6c63a380eb7ff75cd29ed27486d4259066aee
This commit is contained in:
drh
2018-12-14 03:14:18 +00:00
parent e45985b595
commit 203b1ea0f5
3 changed files with 14 additions and 10 deletions

View File

@@ -992,6 +992,13 @@ static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){
*pRC = rc;
return;
}
if( ((char*)sqlite3PagerGetExtra(pDbPage))[0]!=0 ){
/* The first byte of the extra data is the MemPage.isInit byte.
** If that byte is set, it means this page is also being used
** as a btree page. */
*pRC = SQLITE_CORRUPT_BKPT;
goto ptrmap_exit;
}
offset = PTRMAP_PTROFFSET(iPtrmap, key);
if( offset<0 ){
*pRC = SQLITE_CORRUPT_BKPT;