1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Use unsigned integers to count the number of pages in a freelist during

an integrity_check, to avoid any possibility of a signed integer overflow.

FossilOrigin-Name: 05b87e0755638d31f6d8918f8758362f8c3981661449b5171180a8498f66bd9d
This commit is contained in:
drh
2019-02-26 16:17:06 +00:00
parent 2b454e0335
commit eaac9996ed
3 changed files with 10 additions and 10 deletions

View File

@@ -9616,10 +9616,10 @@ static void checkList(
IntegrityCk *pCheck, /* Integrity checking context */
int isFreeList, /* True for a freelist. False for overflow page list */
int iPage, /* Page number for first page in the list */
int N /* Expected number of pages in the list */
u32 N /* Expected number of pages in the list */
){
int i;
int expected = N;
u32 expected = N;
int nErrAtStart = pCheck->nErr;
while( iPage!=0 && pCheck->mxErr ){
DbPage *pOvflPage;
@@ -9878,7 +9878,7 @@ static int checkTreePage(
/* Check the content overflow list */
if( info.nPayload>info.nLocal ){
int nPage; /* Number of pages on the overflow chain */
u32 nPage; /* Number of pages on the overflow chain */
Pgno pgnoOvfl; /* First page of the overflow chain */
assert( pc + info.nSize - 4 <= usableSize );
nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);