Fix a couple of memory-sanitizer complaints that could be triggered by a corrupt database.
FossilOrigin-Name: 39c8686cabe6c437ba4860aade49a701c4f5772b97d9fbe6cb9a394e85b9c092
This commit is contained in:
commit
531d01cae0
15
manifest
15
manifest
@ -1,5 +1,5 @@
|
||||
C Add\sOOM\stest\scase\sassociated\swith\sthe\sfix\sin\sthe\sprevious\scommit.
|
||||
D 2021-02-27T15:32:02.041
|
||||
C Fix\sa\scouple\sof\smemory-sanitizer\scomplaints\sthat\scould\sbe\striggered\sby\sa\scorrupt\sdatabase.
|
||||
D 2021-03-01T16:16:59.534
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -483,7 +483,7 @@ F src/auth.c 08954fdc4cc2da5264ba5b75cfd90b67a6fc7d1710a02ccf917c38eadec77853
|
||||
F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d
|
||||
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
|
||||
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
|
||||
F src/btree.c 694020ad8a3af3d79b09f74c8f1421272a419cdea42a13401e3b0f7dea6e9c3e
|
||||
F src/btree.c bafa3a2e8b6622a3aa8791f90c8ecc70e8ae551ba9023f865213890f5b8a8994
|
||||
F src/btree.h 285f8377aa1353185a32bf455faafa9ff9a0d40d074d60509534d14990c7829e
|
||||
F src/btreeInt.h 7614cae30f95b6aed0c7cac7718276a55cfe2c77058cbfd8bef5b75329757331
|
||||
F src/build.c e1790f21cd19708af231ceed5e52f495b94c4b2609e27d2b5ce2805a9aa3464e
|
||||
@ -534,7 +534,7 @@ F src/pager.h 4bf9b3213a4b2bebbced5eaa8b219cf25d4a82f385d093cd64b7e93e5285f66f
|
||||
F src/parse.y f3e8d7978c10495850c0bb502fe2669b55cf2841c4670b1f7261782e82069471
|
||||
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
|
||||
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
|
||||
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
|
||||
F src/pcache1.c 388304fd2d91c39591080b5e0f3c62cfba87db20370e7e0554062bfb29740e9f
|
||||
F src/pragma.c 6daaaecc26a4b09481d21722525b079ce756751a43a79cc1d8f122d686806193
|
||||
F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf
|
||||
F src/prepare.c f634a9e799a6b1c136d8ee12479cffa22862bfb807d307b1db406aa0cdb042a5
|
||||
@ -1908,7 +1908,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P ccb8cf5256d01b3ff13e75e1471b1afb0055ec2c344ba886f98b83d47eba00f8
|
||||
R 2795f9db27433289f60f8c83de7cdc69
|
||||
P a631c38d22bc00d38b0f112a623fb24c0e03a962f661ffe0931dad32fd31ba31 d235d406283191fc7b9e1299be602f1e8be6f36cee8b183cf85c8660519a1c3b
|
||||
R 77dd21d5cda99cecce763a4b3e142b99
|
||||
T +closed d235d406283191fc7b9e1299be602f1e8be6f36cee8b183cf85c8660519a1c3b
|
||||
U dan
|
||||
Z fb78150b0343349ad1b18165979cb24b
|
||||
Z 89e7b2d8688a895f01f8719482567db5
|
||||
|
@ -1 +1 @@
|
||||
a631c38d22bc00d38b0f112a623fb24c0e03a962f661ffe0931dad32fd31ba31
|
||||
39c8686cabe6c437ba4860aade49a701c4f5772b97d9fbe6cb9a394e85b9c092
|
12
src/btree.c
12
src/btree.c
@ -7637,7 +7637,9 @@ static int balance_nonroot(
|
||||
}
|
||||
pgno = get4byte(pRight);
|
||||
while( 1 ){
|
||||
rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);
|
||||
}
|
||||
if( rc ){
|
||||
memset(apOld, 0, (i+1)*sizeof(MemPage*));
|
||||
goto balance_cleanup;
|
||||
@ -7676,12 +7678,10 @@ static int balance_nonroot(
|
||||
if( pBt->btsFlags & BTS_FAST_SECURE ){
|
||||
int iOff;
|
||||
|
||||
/* If the following if() condition is not true, the db is corrupted.
|
||||
** The call to dropCell() below will detect this. */
|
||||
iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
|
||||
if( (iOff+szNew[i])>(int)pBt->usableSize ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
memset(apOld, 0, (i+1)*sizeof(MemPage*));
|
||||
goto balance_cleanup;
|
||||
}else{
|
||||
if( (iOff+szNew[i])<=(int)pBt->usableSize ){
|
||||
memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);
|
||||
apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];
|
||||
}
|
||||
|
@ -461,6 +461,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){
|
||||
p->page.pExtra = &p[1];
|
||||
p->isBulkLocal = 0;
|
||||
p->isAnchor = 0;
|
||||
p->pLruPrev = 0; /* Initializing this saves a valgrind error */
|
||||
}
|
||||
(*pCache->pnPurgeable)++;
|
||||
return p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user