1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Convert an assert() in R-Tree into a database corruption detection case.

FossilOrigin-Name: 48b518eb6f76fb0beb161d1ebcf3b793efc36262d6d77a1ad5906b6501138e28
This commit is contained in:
drh
2019-07-29 17:18:45 +00:00
parent 8279fe8a4b
commit 8fbcb04811
4 changed files with 282 additions and 10 deletions

View File

@ -669,7 +669,6 @@ static int nodeAcquire(
** increase its reference count and return it.
*/
if( (pNode = nodeHashLookup(pRtree, iNode))!=0 ){
assert( !pParent || !pNode->pParent || pNode->pParent==pParent );
if( pParent && !pNode->pParent ){
if( nodeInParentChain(pNode, pParent) ){
RTREE_IS_CORRUPT(pRtree);
@ -677,6 +676,9 @@ static int nodeAcquire(
}
pParent->nRef++;
pNode->pParent = pParent;
}else if( pParent && pNode->pParent && pParent!=pNode->pParent ){
RTREE_IS_CORRUPT(pRtree);
return SQLITE_CORRUPT_VTAB;
}
pNode->nRef++;
*ppNode = pNode;