mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Allocate a few extra bytes for the pager temp page as an overrun buffer while
processing corrupt database files. FossilOrigin-Name: e7aca0714bc475e04b16e9db78722ce025d2a1382f80cfc0a49cff2af904eae5
This commit is contained in:
10
src/pager.c
10
src/pager.c
@@ -3786,8 +3786,14 @@ int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
|
||||
rc = sqlite3OsFileSize(pPager->fd, &nByte);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
pNew = (char *)sqlite3PageMalloc(pageSize);
|
||||
if( !pNew ) rc = SQLITE_NOMEM_BKPT;
|
||||
/* 8 bytes of zeroed overrun space is sufficient so that the b-tree
|
||||
* cell header parser will never run off the end of the allocation */
|
||||
pNew = (char *)sqlite3PageMalloc(pageSize+8);
|
||||
if( !pNew ){
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
}else{
|
||||
memset(pNew+pageSize, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
|
Reference in New Issue
Block a user