1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix a serious bug in INSERT when the source is a SELECT. (CVS 366)

FossilOrigin-Name: 20ea737536700b016385c70105a2af8b2bffce2b
This commit is contained in:
drh
2002-02-03 19:06:02 +00:00
parent 1bffb9c84f
commit 24e97df9c7
13 changed files with 126 additions and 41 deletions

View File

@@ -30,7 +30,7 @@
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
** $Id: vdbe.c,v 1.116 2002/02/03 03:34:09 drh Exp $
** $Id: vdbe.c,v 1.117 2002/02/03 19:06:03 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -3493,7 +3493,7 @@ case OP_CreateTable: {
** This opcode is used for testing purposes only.
*/
case OP_SanityCheck: {
#if 1 /* This opcode used for testing only */
#ifndef NDEBUG /* This opcode used for testing only */
int nRoot;
int *aRoot;
int tos = ++p->tos;
@@ -3503,10 +3503,8 @@ case OP_SanityCheck: {
HashElem *i;
char *z;
if( iSet<0 || iSet>=p->nSet ){
goto bad_instruction;
}
VERIFY( if( NeedStack(p, p->tos) ) goto no_mem; )
if( iSet<0 || iSet>=p->nSet ) goto bad_instruction;
if( NeedStack(p, p->tos) ) goto no_mem;
pSet = &p->aSet[iSet];
nRoot = sqliteHashCount(&pSet->hash);
aRoot = sqliteMalloc( sizeof(int)*(nRoot+1) );
@@ -3525,7 +3523,8 @@ case OP_SanityCheck: {
aStack[tos].n = strlen(z) + 1;
aStack[tos].flags = STK_Str | STK_Dyn;
}
#endif /* SQLITE_TEST */
sqliteFree(aRoot);
#endif /* !define(NDEBUG) */
break;
}