1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Fix a critical bug in sqlite3_prepare_v2 that can lead to segfaults when

the schema changes and the statement is recompiled automatically.
Ticket #2154. (CVS 3576)

FossilOrigin-Name: 3401388dba6c150f788397a4dfbcdb01313247e2
This commit is contained in:
drh
2007-01-08 21:07:17 +00:00
parent 622fa9a80e
commit c515525765
6 changed files with 247 additions and 158 deletions

View File

@@ -65,19 +65,27 @@ const char *sqlite3VdbeGetSql(Vdbe *p){
}
/*
** Swap the set of Opcodes between to Vdbe structures. No
** other parts of either Vdbe structure are changed.
** Swap all content between two VDBE structures.
*/
void sqlite3VdbeSwapOps(Vdbe *pA, Vdbe *pB){
Op *aOp;
int nOp;
aOp = pA->aOp;
nOp = pA->nOp;
pA->aOp = pB->aOp;
pA->nOp = pB->nOp;
pB->aOp = aOp;
pB->nOp = nOp;
void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
Vdbe tmp, *pTmp;
char *zTmp;
int nTmp;
tmp = *pA;
*pA = *pB;
*pB = tmp;
pTmp = pA->pNext;
pA->pNext = pB->pNext;
pB->pNext = pTmp;
pTmp = pA->pPrev;
pA->pPrev = pB->pPrev;
pB->pPrev = pTmp;
zTmp = pA->zSql;
pA->zSql = pB->zSql;
pB->zSql = zTmp;
nTmp = pA->nSql;
pA->nSql = pB->nSql;
pB->nSql = nTmp;
}
/*