]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
If the 'rootpage' column of the sqlite_master table contains a NULL value, return...
authordanielk1977 <danielk1977@noemail.net>
Mon, 8 Sep 2008 09:06:18 +0000 (09:06 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Mon, 8 Sep 2008 09:06:18 +0000 (09:06 +0000)
FossilOrigin-Name: a7b7b126e9e9b0cd2d68643d8dff321cf41ce2ee

manifest
manifest.uuid
src/prepare.c
test/corrupt2.test

index a71653208d186a10eca04b4f60ef588894a99061..67e3ddda8730717430ca902abfa4460c1ee5a631 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sheader\sfile\ssqliteicu.h\sto\sthe\sICU\sextension.\sThis\sis\sanalogous\sto\sthe\srtree.h\sand\sfts3.h\sheaders\sused\sby\sother\sextensions\sto\sdeclare\stheir\sentry\spoints.\sFix\sfor\sticket\s#3361.\s(CVS\s5680)
-D 2008-09-08T08:08:09
+C If\sthe\s'rootpage'\scolumn\sof\sthe\ssqlite_master\stable\scontains\sa\sNULL\svalue,\sreturn\sSQLITE_CORRUPT\sto\sthe\scaller.\s(CVS\s5681)
+D 2008-09-08T09:06:19
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in d15a7ebfe5e057a72a49805ffb302dbb601c8329
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -142,7 +142,7 @@ F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8
 F src/pcache.c ff79cb5eb797d0f1a244b4332c2d39cb5cfd066b
 F src/pcache.h 53730c33310cdf7a5c94e8333c853d59a3b30226
 F src/pragma.c 9d00ed41b261968757c02707e1508a707f2d46a7
-F src/prepare.c b708c5a8af1870145e93da88ec8f755e9e3efaf6
+F src/prepare.c c7e00ed1b0bdcf699b1aad651247d4dc3d281b0b
 F src/printf.c 785f87120589c1db672e37c6eb1087c456e6f84d
 F src/random.c 11bbdf7def3746a762fbdb56c9d04648135ad6d8
 F src/resolve.c a6abf83125bce0c80ba04acc27c3565155ad305c
@@ -252,7 +252,7 @@ F test/colmeta.test 087c42997754b8c648819832241daf724f813322
 F test/colname.test bc396d99a11a855370010c7e95187177592b1dfe
 F test/conflict.test bb29b052c60a1f7eb6382be77902061d1f305318
 F test/corrupt.test 5bcf7a986358123b8055dfa64b45fc2fb54dcaa9
-F test/corrupt2.test d1e209b0a60e72e493cdedaaf992c04466e14c70
+F test/corrupt2.test 62a2773b86c96e5d1a7f15396c6022e5cbdf4973
 F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32
 F test/corrupt4.test acdb01afaedf529004b70e55de1a6f5a05ae7fff
 F test/corrupt5.test 7796d5bdfe155ed824cee9dff371f49da237cfe0
@@ -632,7 +632,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 7c0f638ef3d7ff9156f07d6fb01448453ffcf5ac
-R 4a1efcaea2f131dfd44298514b9ce3f7
+P 79364b963b348d5433da737b4e21e97952882389
+R 39b97310e19679d7df923788ff2f1b2d
 U danielk1977
-Z 7597622eae79bdd1df2cc819cd2a8a3f
+Z 99c7b68e3038fbf05d1b53e87e37df07
index efb60e476211731908b7d84ca6215588df28349c..f40cd53f0af74830c36cd089190cc60462ab6b70 100644 (file)
@@ -1 +1 @@
-79364b963b348d5433da737b4e21e97952882389
\ No newline at end of file
+a7b7b126e9e9b0cd2d68643d8dff321cf41ce2ee
\ No newline at end of file
index b792b12f35890f6bb4566717e7cb1e9540e25534..d6117941ab2ee0e8babfaa06672b41581f1f27ef 100644 (file)
@@ -13,7 +13,7 @@
 ** interface, and routines that contribute to loading the database schema
 ** from disk.
 **
-** $Id: prepare.c,v 1.96 2008/09/04 12:03:43 shane Exp $
+** $Id: prepare.c,v 1.97 2008/09/08 09:06:19 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -65,13 +65,11 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **azColName){
   }
 
   assert( argc==3 );
+  assert( iDb>=0 && iDb<db->nDb );
   if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */
   if( argv[1]==0 ){
     corruptSchema(pData, argv[0], 0);
-    return 1;
-  }
-  assert( iDb>=0 && iDb<db->nDb );
-  if( argv[2] && argv[2][0] ){
+  }else if( argv[2] && argv[2][0] ){
     /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
     ** But because db->init.busy is set to 1, no VDBE code is generated
     ** or executed.  All the parser does is build the internal data
index 6536050dc520badc37bdaf504669f0105e1b3040..acdf7a53fddb7d5dccaba2e85efaedd3e8515ba5 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests to make sure SQLite does not crash or
 # segfault if it sees a corrupt database file.
 #
-# $Id: corrupt2.test,v 1.15 2008/08/27 16:14:21 drh Exp $
+# $Id: corrupt2.test,v 1.16 2008/09/08 09:06:19 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -232,6 +232,7 @@ Page 4 is never used}}
 db2 close
 
 proc corruption_test {args} {
+  set A(-corrupt) {}
   array set A $args
 
   catch {db close}
@@ -440,4 +441,18 @@ corruption_test -sqlprep {
   } {1 {database disk image is malformed}}
 }
 
+corruption_test -sqlprep {
+  CREATE TABLE t1(a, b, c);
+  CREATE TABLE t2(a, b, c);
+  PRAGMA writable_schema = 1;
+  UPDATE sqlite_master SET rootpage = NULL WHERE name = 't2';
+} -test {
+  do_test corrupt2-10.1 {
+    catchsql { SELECT * FROM t2 }
+  } {1 {malformed database schema (t2)}}
+  do_test corrupt2-10.2 {
+    sqlite3_errcode db
+  } {SQLITE_CORRUPT}
+}
+
 finish_test