]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a case in where.c where a crash can follow a malloc failure. Also modify test...
authordanielk1977 <danielk1977@noemail.net>
Wed, 29 Apr 2009 11:50:53 +0000 (11:50 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 29 Apr 2009 11:50:53 +0000 (11:50 +0000)
FossilOrigin-Name: 9664e2b6c69271a7ca55af7812a186773a7c6592

manifest
manifest.uuid
src/test8.c
src/where.c

index d9f289bd8de822265c31991cce31ac2d72766dd0..6e1001e527362504ec668bcda03f180a4f5503d8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\sversion\sof\scellSizePtr()\sthat\sis\sfaster\sthan\susing\ssqlite3BtreeParseCellPtr().\sThis\sspeeds\sup\sbalance_nonroot().\s(CVS\s6566)
-D 2009-04-29T11:31:47
+C Fix\sa\scase\sin\swhere.c\swhere\sa\scrash\scan\sfollow\sa\smalloc\sfailure.\sAlso\smodify\stest\scode\sin\stest8.c\sto\scheck\sa\sreturn\scode\sthat\swas\sbeing\sdropped\s(causing\sa\stest\sin\svtab_err.test\sto\sfail).\s(CVS\s6567)
+D 2009-04-29T11:50:54
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -174,7 +174,7 @@ F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c
 F src/test5.c 162a1cea2105a2c460a3f39fa6919617b562a288
 F src/test6.c 1a0a7a1f179469044b065b4a88aab9faee114101
 F src/test7.c b94e68c2236de76889d82b8d7d8e00ad6a4d80b1
-F src/test8.c b1061548f7ce3aeedea3cc4d649ee1487c2b4eaf
+F src/test8.c 34719910286a0a6ca233f10ba66558be938494dd
 F src/test9.c 963d380922f25c1c323712d05db01b19197ee6f7
 F src/test_async.c 731d23f953ece5bf40ce87810cfb7607218953c5
 F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad
@@ -212,7 +212,7 @@ F src/vdbeblob.c e67757450ae8581a8b354d9d7e467e41502dfe38
 F src/vdbemem.c 111d8193859d16aefd5d3cb57472808584ea5503
 F src/vtab.c 53355aa2381ec3ef2eaad25672cfd5877a02fe45
 F src/walker.c 7cdf63223c953d4343c6833e940f110281a378ee
-F src/where.c d20e083e5cc549a04f1647ee180d3bc3d2c73c02
+F src/where.c de8984ae4c5283f55ec2081bbbdba0375b9e3aa9
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@@ -725,7 +725,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P fc3a5ac2353142082fe14d47f9c2b662407ea3f7
-R 7f4b713c43e75500014d39ff57631373
+P e8f7f7b787fe941093edaea44db4d361fad1e002
+R 4de805b014550f062517076b8e0aa32b
 U danielk1977
-Z 7a846e8596d6c8f108ba0f337c171b19
+Z cc423cf5b9f2744841b886533297cfcf
index 6d5b72f7a7fb94f0476ebc6160e32d89759002ed..9c57c32ab9a53d52645bbcd8f5cb8f2fc9ca2fed 100644 (file)
@@ -1 +1 @@
-e8f7f7b787fe941093edaea44db4d361fad1e002
\ No newline at end of file
+9664e2b6c69271a7ca55af7812a186773a7c6592
\ No newline at end of file
index fa26677fecd17d5501a66923201db3bf28de5f0d..a313c2601dedfcfe2b1f3490d33dfdb1df017d1d 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test8.c,v 1.77 2009/04/21 09:02:47 danielk1977 Exp $
+** $Id: test8.c,v 1.78 2009/04/29 11:50:54 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -695,7 +695,7 @@ static int echoFilter(
   rc = sqlite3_prepare(db, idxStr, -1, &pCur->pStmt, 0);
   assert( pCur->pStmt || rc!=SQLITE_OK );
   for(i=0; rc==SQLITE_OK && i<argc; i++){
-    sqlite3_bind_value(pCur->pStmt, i+1, argv[i]);
+    rc = sqlite3_bind_value(pCur->pStmt, i+1, argv[i]);
   }
 
   /* If everything was successful, advance to the first row of the scan */
index f02689b3e713fe2031cb181dc78569ce488e5556..3f850d6d23270be8061c487c0246747d691f3594 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.390 2009/04/24 15:46:22 drh Exp $
+** $Id: where.c,v 1.391 2009/04/29 11:50:54 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -1747,6 +1747,12 @@ static void bestVirtualIndex(
   int i, j;
   int nOrderBy;
 
+  /* Make sure wsFlags is initialized to some sane value. Otherwise, if the 
+  ** malloc in allocateIndexInfo() fails and this function returns leaving
+  ** wsFlags in an uninitialized state, the caller may behave unpredictably.
+  */
+  pCost->plan.wsFlags = WHERE_VIRTUALTABLE;
+
   /* If the sqlite3_index_info structure has not been previously
   ** allocated and initialized, then allocate and initialize it now.
   */
@@ -1830,7 +1836,6 @@ static void bestVirtualIndex(
   }else{
     pCost->rCost = pIdxInfo->estimatedCost;
   }
-  pCost->plan.wsFlags = WHERE_VIRTUALTABLE;
   pCost->plan.u.pVtabIdx = pIdxInfo;
   if( pIdxInfo && pIdxInfo->orderByConsumed ){
     pCost->plan.wsFlags |= WHERE_ORDERBY;