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

In the VDBE, check to make sure a set has been initialized before using it.

Ticket #185. (CVS 772)

FossilOrigin-Name: 8c4cbdd05517e91879a0f2c4559d0f0518d2385b
This commit is contained in:
drh
2002-10-30 22:42:58 +00:00
parent 1f16230b5c
commit 38dd0b4ff0
4 changed files with 55 additions and 13 deletions

View File

@@ -36,7 +36,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.181 2002/10/22 15:04:34 drh Exp $
** $Id: vdbe.c,v 1.182 2002/10/30 22:42:59 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -5162,7 +5162,7 @@ case OP_SetFound: {
int tos = p->tos;
VERIFY( if( tos<0 ) goto not_enough_stack; )
if( Stringify(p, tos) ) goto no_mem;
if( VERIFY( i>=0 && i<p->nSet &&)
if( i>=0 && i<p->nSet &&
sqliteHashFind(&p->aSet[i].hash, zStack[tos], aStack[tos].n)){
pc = pOp->p2 - 1;
}
@@ -5181,7 +5181,7 @@ case OP_SetNotFound: {
int tos = p->tos;
VERIFY( if( tos<0 ) goto not_enough_stack; )
if( Stringify(p, tos) ) goto no_mem;
if(VERIFY( i>=0 && i<p->nSet &&)
if( i<0 || i>=p->nSet ||
sqliteHashFind(&p->aSet[i].hash, zStack[tos], aStack[tos].n)==0 ){
pc = pOp->p2 - 1;
}
@@ -5205,7 +5205,10 @@ case OP_SetFirst:
case OP_SetNext: {
Set *pSet;
int tos;
VERIFY( if( pOp->p1<0 || pOp->p1>=p->nSet ) goto bad_instruction; )
if( pOp->p1<0 || pOp->p1>=p->nSet ){
if( pOp->opcode==OP_SetFirst ) pc = pOp->p2 - 1;
break;
}
pSet = &p->aSet[pOp->p1];
if( pOp->opcode==OP_SetFirst ){
pSet->prev = sqliteHashFirst(&pSet->hash);