1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +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

@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.41 2006/11/09 00:24:54 drh Exp $
** $Id: prepare.c,v 1.42 2007/01/08 21:07:18 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -575,7 +575,8 @@ int sqlite3Reprepare(Vdbe *p){
}else{
assert( pNew!=0 );
}
sqlite3VdbeSwapOps(pNew, p);
sqlite3VdbeSwap(pNew, p);
sqlite3_transfer_bindings((sqlite3_stmt*)pNew, (sqlite3_stmt*)p);
sqlite3_finalize((sqlite3_stmt*)pNew);
return 1;
}