@@ -50422,6 +50422,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){
5042250422 p->page.pExtra = &p[1];
5042350423 p->isBulkLocal = 0;
5042450424 p->isAnchor = 0;
50425+ p->pLruPrev = 0; /* Initializing this saves a valgrind error */
5042550426 }
5042650427 (*pCache->pnPurgeable)++;
5042750428 return p;
@@ -72324,7 +72325,9 @@ static int balance_nonroot(
7232472325 }
7232572326 pgno = get4byte(pRight);
7232672327 while( 1 ){
72327- rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
72328+ if( rc==SQLITE_OK ){
72329+ rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
72330+ }
7232872331 if( rc ){
7232972332 memset(apOld, 0, (i+1)*sizeof(MemPage*));
7233072333 goto balance_cleanup;
@@ -72363,12 +72366,10 @@ static int balance_nonroot(
7236372366 if( pBt->btsFlags & BTS_FAST_SECURE ){
7236472367 int iOff;
7236572368
72369+ /* If the following if() condition is not true, the db is corrupted.
72370+ ** The call to dropCell() below will detect this. */
7236672371 iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
72367- if( (iOff+szNew[i])>(int)pBt->usableSize ){
72368- rc = SQLITE_CORRUPT_BKPT;
72369- memset(apOld, 0, (i+1)*sizeof(MemPage*));
72370- goto balance_cleanup;
72371- }else{
72372+ if( (iOff+szNew[i])<=(int)pBt->usableSize ){
7237272373 memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
7237372374 apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
7237472375 }
@@ -231234,7 +231235,7 @@ SQLITE_API int sqlite3_stmt_init(
231234231235#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
231235231236
231236231237/************** End of stmt.c ************************************************/
231237- #if __LINE__!=231237
231238+ #if __LINE__!=231238
231238231239#undef SQLITE_SOURCE_ID
231239231240#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 b7738010bc8ef02ba84820368e557306390a33c38adaa5c7703154bae3edalt2"
231240231241#endif
0 commit comments