]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In the VDBE, check to make sure a set has been initialized before using it.
authordrh <drh@noemail.net>
Wed, 30 Oct 2002 22:42:58 +0000 (22:42 +0000)
committerdrh <drh@noemail.net>
Wed, 30 Oct 2002 22:42:58 +0000 (22:42 +0000)
Ticket #185. (CVS 772)

FossilOrigin-Name: 8c4cbdd05517e91879a0f2c4559d0f0518d2385b

manifest
manifest.uuid
src/vdbe.c
test/in.test

index bcbe5aa229e661086b8279203156fa874caf4466..fb789598e82eb45486a1d162fb5f0c4785d53181 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Minimal\ssupport\sfor\soracle8\souter\sjoin\ssyntax.\s(CVS\s771)
-D 2002-10-27T19:35:34
+C In\sthe\sVDBE,\scheck\sto\smake\ssure\sa\sset\shas\sbeen\sinitialized\sbefore\susing\sit.\nTicket\s#185.\s(CVS\s772)
+D 2002-10-30T22:42:59
 F Makefile.in d6c9a85c2a5e696843201d090dcf8bf2f8716f2a
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -52,7 +52,7 @@ F src/tokenize.c 75e3bb37305b64e118e709752066f494c4f93c30
 F src/trigger.c 5ba917fc226b96065108da28186c2efaec53e481
 F src/update.c 881e4c8e7c786545da4fd2d95da19252b2e31137
 F src/util.c ca7650ef2cc2d50241e48029fca109a3016144ee
-F src/vdbe.c b5d25c18f306cdb1da145dd555b056057920521f
+F src/vdbe.c 921f75ea3fbf2df4480c1ec9f8522843d5839997
 F src/vdbe.h b7584044223104ba7896a7f87b66daebdd6022ba
 F src/where.c 615a0f0bed305bcb27073c69347ea75018e8b58d
 F test/all.test efd958d048c70a3247997c482f0b33561f7759f0
@@ -67,7 +67,7 @@ F test/expr.test dea1cd62684a8bf116426447c948f5e8fb2c84b6
 F test/fkey1.test 33c850201a6ec35f0b370daf4e57f44456f1b35d
 F test/format3.test cbb168d446152fcf1dd85be299ad2d6cd507da4e
 F test/func.test bed7ae7a3482df05db0f5eed2debdf25ac2d07fc
-F test/in.test e59461f1702b7387880bf08a0ce6bb777925d282
+F test/in.test 15428c85d141edda7543bfc3f9a32ce65193717b
 F test/index.test 2a5a1b654f50ca0768fb10ae44b72e6a776b1f18
 F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
 F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
@@ -149,7 +149,7 @@ F www/speed.tcl a20a792738475b68756ea7a19321600f23d1d803
 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 3b68aa25c451b7c09ece457ac2b70a9a5d93508a
-R f078ec26197d58bed051ed1d4802e2fc
+P 31df3690d0fe4bd4a293cbe8ca9a26c98c3ed3ce
+R eb80ca88edb7341c8e42b523ac2c342a
 U drh
-Z e77ead48c863ebb46d0070eee477e05f
+Z 8e88b9a64c45827fb45a696ea6365971
index 27dda7cc5ff763a423d217bcbe2b6b403bb9d95f..bb8cffe524d8bea4d035014ea4743074031ff91f 100644 (file)
@@ -1 +1 @@
-31df3690d0fe4bd4a293cbe8ca9a26c98c3ed3ce
\ No newline at end of file
+8c4cbdd05517e91879a0f2c4559d0f0518d2385b
\ No newline at end of file
index 82544869310be8b4e27c9d7aa2f3a5794badd123..d58fa2cdfbf64fdb53c99b2755131f75aabd0109 100644 (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);
index 019d3bc5a496176edd29cf97524c15611bc1b45a..4cbff3750dd49ec21e0edbb2f3e831cf205fb917 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the IN and BETWEEN operator.
 #
-# $Id: in.test,v 1.7 2002/07/01 00:31:36 drh Exp $
+# $Id: in.test,v 1.8 2002/10/30 22:42:59 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -227,4 +227,43 @@ do_test in-6.10 {
   }
 } {4 6 8 10}
 
+# Tests of IN operator against empty sets.  (Ticket #185)
+#
+do_test in-7.1 {
+  execsql {
+    SELECT a FROM t1 WHERE a IN ();
+  }
+} {}
+do_test in-7.2 {
+  execsql {
+    SELECT a FROM t1 WHERE a IN (5);
+  }
+} {5}
+do_test in-7.3 {
+  execsql {
+    SELECT a FROM t1 WHERE a NOT IN () ORDER BY a;
+  }
+} {5 6 7 8 hello}
+do_test in-7.4 {
+  execsql {
+    SELECT a FROM t1 WHERE a IN (5) AND b IN ();
+  }
+} {}
+do_test in-7.5 {
+  execsql {
+    SELECT a FROM t1 WHERE a IN (5) AND b NOT IN ();
+  }
+} {5}
+do_test in-7.6 {
+  execsql {
+    SELECT a FROM ta WHERE a IN ();
+  }
+} {}
+do_test in-7.7 {
+  execsql {
+    SELECT a FROM ta WHERE a NOT IN ();
+  }
+} {1 2 3 4 6 8 10}
+
+
 finish_test