]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Harden the STAT4 logic in where.c against OOM faults.
authordrh <drh@noemail.net>
Tue, 3 Sep 2013 19:26:22 +0000 (19:26 +0000)
committerdrh <drh@noemail.net>
Tue, 3 Sep 2013 19:26:22 +0000 (19:26 +0000)
FossilOrigin-Name: 91d2cfbc95c34c0040deb69106bb9f895abb94c0

manifest
manifest.uuid
src/where.c

index 680f65071a85e48b40fb4e7ed9c8350b8a2f15ec..0a72bf87ba4f7fa739af972ca0468d1e71fd58c3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sanother\sproblem\sin\sstat4\ssample\sselection.
-D 2013-09-03T14:43:12.842
+C Harden\sthe\sSTAT4\slogic\sin\swhere.c\sagainst\sOOM\sfaults.
+D 2013-09-03T19:26:22.132
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -290,7 +290,7 @@ F src/vtab.c 165ce0e797c2cd23badb104c9f2ae9042d6d942c
 F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
 F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
-F src/where.c 99477e9dd4d4d33be32115b4fbd18b6f033d045a
+F src/where.c 1fe091c69412b9eddae05e160260781394b41631
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@@ -1109,7 +1109,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P 0303d6bc7112e6f810ae1bd75cafc5ffc51f5212
-R ae0a46263eba3c1ef0a78f34bdb8ef01
-U dan
-Z 3daa1eef98d5cdbb101dd3c2f83cf235
+P d59f580904e6e7e90fc0a692a3dd4eeff5942479
+R fe3c8072a3f0ead6396100d646dd55b5
+U drh
+Z 4e9e05f19356d6ec8498cc0ab2084861
index 549d7b88f66f9ce395c51a12ef4a0aea63446e43..fc2add064f9f19e3f3b03a7528f470677bc03d13 100644 (file)
@@ -1 +1 @@
-d59f580904e6e7e90fc0a692a3dd4eeff5942479
\ No newline at end of file
+91d2cfbc95c34c0040deb69106bb9f895abb94c0
\ No newline at end of file
index b633dfd57437c67a1c2400feb777cb8e9b199d25..d08db48e088905656ec38e08782cb3db48d61de0 100644 (file)
@@ -2421,12 +2421,15 @@ static void whereKeyStats(
   tRowcnt *aStat              /* OUT: stats written here */
 ){
   IndexSample *aSample = pIdx->aSample;
-  int iCol = pRec->nField-1;  /* Index of required stats in anEq[] etc. */
+  int iCol;                   /* Index of required stats in anEq[] etc. */
   int iMin = 0;               /* Smallest sample not yet tested */
   int i = pIdx->nSample;      /* Smallest sample larger than or equal to pRec */
   int iTest;                  /* Next sample to test */
   int res;                    /* Result of comparison operation */
 
+  assert( pRec!=0 || pParse->db->mallocFailed );
+  if( pRec==0 ) return;
+  iCol = pRec->nField - 1;
   assert( pIdx->nSample>0 );
   assert( pRec->nField>0 && iCol<pIdx->nSampleCol );
   do{