]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a bug in handling queries on the sqlite_master table with an empty (0 bytes in...
authordanielk1977 <danielk1977@noemail.net>
Mon, 23 Jun 2008 18:49:43 +0000 (18:49 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Mon, 23 Jun 2008 18:49:43 +0000 (18:49 +0000)
FossilOrigin-Name: f8238770bf41e17014c6de05363b759304fc80de

manifest
manifest.uuid
src/vdbe.c
test/malloc_common.tcl
test/select1.test
test/tester.tcl

index bcf76bfe34c4a920ceab49c8b122343af57b6cd4..8429f2a20f26d2278b78e312fac3a7739ff4d10a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Additional\stests\sadded\sto\scapi3.test.\s(CVS\s5285)
-D 2008-06-23T17:56:47
+C Fix\sa\sbug\sin\shandling\squeries\son\sthe\ssqlite_master\stable\swith\san\sempty\s(0\sbytes\sin\ssize)\sdatabase\sfile.\s(CVS\s5286)
+D 2008-06-23T18:49:44
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -181,7 +181,7 @@ F src/update.c 2d7143b9014e955509cc4f323f9a9584fb898f34
 F src/utf.c 8c94fa10efc78c2568d08d436acc59df4df7191b
 F src/util.c 920d6d5dfdf25f7b85d2093705d8716f9b387e3b
 F src/vacuum.c 14eb21b480924d87e791cd8ab6fb35ac563243ef
-F src/vdbe.c 98d8d2f7a7f4624ee9fd76d53fea3b4a3d737dfa
+F src/vdbe.c 3674e10c76c76deeb8cb75d26c633ee9b663eb82
 F src/vdbe.h 1246ace5511258b2192487581f23985bbc61b1be
 F src/vdbeInt.h 723fb796fc13346e01fb7269dcfe28f74006c5b3
 F src/vdbeapi.c a7c6b8db324cf7eccff32de871dea36aa305c994
@@ -396,7 +396,7 @@ F test/mallocD.test f78c295e8e18ea3029e65ca08278690e00c22100
 F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08
 F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
 F test/mallocG.test b295dc03b6d8d705ce425ff4d1ce6bbeb1c5ab33
-F test/malloc_common.tcl c3b251237a7a1578c49c4f342fa764c4c8fa613c
+F test/malloc_common.tcl cdcf092a77f3578fa4fd02121e60969cdf382e27
 F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8
 F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893
 F test/memleak.test d2d2a1ff7105d32dc3fdf691458cf6cba58c7217
@@ -438,7 +438,7 @@ F test/rtree.test a8404a59bbc3a7827db9bfb334790c852f0391b3
 F test/safety.test b69e2b2dd5d52a3f78e216967086884bbc1a09c6
 F test/schema.test a8b000723375fd42c68d310091bdbd744fde647c
 F test/schema2.test 35e1c9696443d6694c8980c411497c2b5190d32e
-F test/select1.test 871df931cbbc0e78170605628e8b5fc60765e265
+F test/select1.test 2f011e7aa0accada53795bc95f00d268a3811bd4
 F test/select2.test 06a2660de57673e2d076c29c0fd73f961a930f87
 F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054
 F test/select4.test 7cc135c8343e6e433bdad185de6a720b112c40e7
@@ -474,7 +474,7 @@ F test/tableapi.test 892208d49e7be4817a4d3e4f641dbcbbee8cd03c
 F test/tclsqlite.test 3dfb48f46de4353376fad835390b493ba066b4dc
 F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
 F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
-F test/tester.tcl 1b57a6bfe913c6b2a12a32e21263bb5dcb0e08e1
+F test/tester.tcl e9971a96183c23e70c7de5a3fbd38e87b4083aea
 F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7
 F test/thread002.test 2c4ad2c386f60f6fe268cd91c769ee35b3c1fd0b
 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
@@ -592,7 +592,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 3ca7dab88e030cc945e0d358d7f53ddca35bc221
-R 90ee4c267ce50621164d3fc140bcfcee
-U drh
-Z 3b00e032d2531d8d31a48af81a734f31
+P 1fdab2c65b966f74bdf130c640ae56a0e811fb71
+R c7364517d4c619ea19df18d184a56ae2
+U danielk1977
+Z 59f57be1dc35db9ff15212786f4c3c03
index 2770a191a05bd3012b78e12a2992e5dc25808a6e..00fa7343e9ef17bc179edb589004875365bd8bb6 100644 (file)
@@ -1 +1 @@
-1fdab2c65b966f74bdf130c640ae56a0e811fb71
\ No newline at end of file
+f8238770bf41e17014c6de05363b759304fc80de
\ No newline at end of file
index 5bfe1f5ba6adfb4e115c8243511c05754711cd4c..07c64f2e6dcd28d5d556fb2c0c0648b80f2d4a57 100644 (file)
@@ -43,7 +43,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.753 2008/06/22 12:37:58 drh Exp $
+** $Id: vdbe.c,v 1.754 2008/06/23 18:49:44 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -3006,6 +3006,12 @@ case OP_MoveGt: {       /* jump, in3 */
     if( res ){
       pc = pOp->p2 - 1;
     }
+  }else if( !pC->pseudoTable ){
+    /* This happens when attempting to open the sqlite3_master table
+    ** for read access returns SQLITE_EMPTY. In this case always
+    ** take the jump (since there are no records in the table).
+    */
+    pc = pOp->p2 - 1;
   }
   break;
 }
@@ -3213,6 +3219,13 @@ case OP_NotExists: {        /* jump, in3 */
       pc = pOp->p2 - 1;
       assert( pC->rowidIsValid==0 );
     }
+  }else if( !pC->pseudoTable ){
+    /* This happens when an attempt to open a read cursor on the 
+    ** sqlite_master table returns SQLITE_EMPTY.
+    */
+    assert( pC->isTable );
+    pc = pOp->p2 - 1;
+    assert( pC->rowidIsValid==0 );
   }
   break;
 }
index 62ec478d64dd9fbb6ff1d7ab7829d73c3ca61315..063ca22fde89842a527902fdb7c3265b1b252cd4 100644 (file)
@@ -12,7 +12,7 @@
 # This file contains common code used by many different malloc tests
 # within the test suite.
 #
-# $Id: malloc_common.tcl,v 1.17 2008/06/19 18:17:50 danielk1977 Exp $
+# $Id: malloc_common.tcl,v 1.18 2008/06/23 18:49:45 danielk1977 Exp $
 
 # If we did not compile with malloc testing enabled, then do nothing.
 #
@@ -23,11 +23,6 @@ ifcapable builtin_test {
   return 0
 }
 
-catch {db close}
-sqlite3_shutdown
-catch {install_malloc_faultsim 1} msg
-sqlite3 db test.db
-
 # Usage: do_malloc_test <test number> <options...>
 #
 # The first argument, <test number>, is an integer used to name the
index 519e693ca46b0ded344758042ac2971e0ac961c2..caadda86c664e664b4c110af4e5a5ba4a24bc811 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the SELECT statement.
 #
-# $Id: select1.test,v 1.57 2007/12/13 07:58:51 danielk1977 Exp $
+# $Id: select1.test,v 1.58 2008/06/23 18:49:45 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -912,4 +912,24 @@ ifcapable subquery {
   } {0}
 }
 
+db close
+file delete -force test.db
+sqlite3 db test.db
+do_test select1-14.1 {
+  execsql { 
+    SELECT * FROM sqlite_master WHERE rowid>10; 
+    SELECT * FROM sqlite_master WHERE rowid=10;
+    SELECT * FROM sqlite_master WHERE rowid<10;
+    SELECT * FROM sqlite_master WHERE rowid<=10;
+    SELECT * FROM sqlite_master WHERE rowid>=10;
+    SELECT * FROM sqlite_master;
+  }
+} {}
+do_test select1-14.2 {
+  execsql { 
+    SELECT 10 IN (SELECT rowid FROM sqlite_master);
+  }
+} {0}
+
 finish_test
+
index e014732ccc61d6ccfaf2f0570631a38b8eb44080..f901df05ff57ac8297447c06a581a14ec188f9c0 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements some common TCL routines used for regression
 # testing the SQLite library
 #
-# $Id: tester.tcl,v 1.127 2008/06/19 00:16:08 drh Exp $
+# $Id: tester.tcl,v 1.128 2008/06/23 18:49:45 danielk1977 Exp $
 
 #
 # What for user input before continuing.  This gives an opportunity
@@ -133,6 +133,11 @@ if {[sqlite3 -has-codec] && [info command sqlite_orig]==""} {
 
 # Create a test database
 #
+if {![info exists nTest]} {
+  sqlite3_shutdown 
+  install_malloc_faultsim 1 
+  sqlite3_initialize
+}
 catch {db close}
 file delete -force test.db
 file delete -force test.db-journal