aboutsummaryrefslogtreecommitdiff
path: root/src/btree.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-02-26 16:17:06 +0000
committerdrh <drh@noemail.net>2019-02-26 16:17:06 +0000
commiteaac9996edf679fd9b081508e23f98e70f5cdcd9 (patch)
tree27f9c7f595805cbf5f708693f52ced2e403a54c3 /src/btree.c
parent2b454e0335cbe14bc96b460ff3695007185fbb6e (diff)
downloadsqlite-eaac9996edf679fd9b081508e23f98e70f5cdcd9.tar.gz
sqlite-eaac9996edf679fd9b081508e23f98e70f5cdcd9.zip
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
Diffstat (limited to 'src/btree.c')
-rw-r--r--src/btree.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/btree.c b/src/btree.c
index aa2c84999..9e7a9c042 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -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);