]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Initialize variables differently in the range processing logic of where.c
authordrh <drh@noemail.net>
Tue, 25 Aug 2009 15:56:51 +0000 (15:56 +0000)
committerdrh <drh@noemail.net>
Tue, 25 Aug 2009 15:56:51 +0000 (15:56 +0000)
in order to make sure variables are always initialized even following
an OOM error.

FossilOrigin-Name: 3fb3686a4502140720dc3710a28a4f4128ab6554

manifest
manifest.uuid
src/where.c

index b8d4ba503a7bcf9533038bc856ea23c227c48ec3..71022e972c870be877c6b26e7df601bedf0be0d2 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Attempt\sto\sclarify\sthe\smeaning\sof\sa\s"parameter"\sin\sthe\ssqlite3_bind()\sAPI\ndocumentation.
-D 2009-08-25T14:59:37
+C Initialize\svariables\sdifferently\sin\sthe\srange\sprocessing\slogic\sof\swhere.c\nin\sorder\sto\smake\ssure\svariables\sare\salways\sinitialized\seven\sfollowing\nan\sOOM\serror.
+D 2009-08-25T15:56:51
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 73ddeec9dd10b85876c5c2ce1fdce627e1dcc7f8
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -216,7 +216,7 @@ F src/vdbeblob.c a3f3e0e877fc64ea50165eec2855f5ada4477611
 F src/vdbemem.c c4a5188ff43692f2ca78d3539ad4877e14b70712
 F src/vtab.c aedd76e8670d5a5379f93804398d3ba960125547
 F src/walker.c 1edca756275f158b80f20eb6f104c8d3fcc96a04
-F src/where.c b9ad2d2db4a7d1cda7bed8a7299eb73fde63b5b1
+F src/where.c fc8b33fb469d30c2d933188757ed4d71a775b08a
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@@ -750,14 +750,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 6a623e6cf0370456232497a84366d18fa180debb
-R fcbb968e51afd78ed3c075342c97e2d1
+P 9389e6a7dad7ba70923282d6fe45fbccd22f681e
+R ba5f45894b6fc316b385ccdbc215e894
 U drh
-Z f375ffcba1ac2c7cffa691451e61067e
+Z 903cfcbc615b7cc03024df17088e7120
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFKk/xjoxKgR168RlERAsnbAJ4wPmuxVLQB8GdAW14JVlkINUJ5QwCfYUBz
-gzYdveWl3zj0kWAvApoKFIs=
-=Gtjj
+iD8DBQFKlAnGoxKgR168RlERAsoLAJ4nH/YFuFnXcU6+a92QUZwF2QQ4ZACeLbl5
+hSBe5ozIRkuFFcem6hDzev0=
+=C0Ud
 -----END PGP SIGNATURE-----
index b02765030afa57c9203893061b5c52c662f0dfff..7c355b3eafa7abd2d5a88ae222d45f81c17db89c 100644 (file)
@@ -1 +1 @@
-9389e6a7dad7ba70923282d6fe45fbccd22f681e
\ No newline at end of file
+3fb3686a4502140720dc3710a28a4f4128ab6554
\ No newline at end of file
index 83632415623108be90e4dbc5c11f17ec02552cc7..ba4cb8072cbe24f8a973270af8a2679e38254c08 100644 (file)
@@ -2038,8 +2038,8 @@ static int whereRangeScanEst(
 
   if( nEq==0 && p->aSample ){
     int iEst;
-    int iUpper;
-    int iLower;
+    int iLower = 0;
+    int iUpper = SQLITE_INDEX_SAMPLES;
     u8 aff = p->pTable->aCol[0].affinity;
 
     if( pLower ){
@@ -2057,17 +2057,14 @@ static int whereRangeScanEst(
       goto range_est_fallback;
     }else if( pLowerVal==0 ){
       rc = whereRangeRegion(pParse, p, pUpperVal, &iUpper);
-      iLower = pLower ? iUpper/2 : 0;
+      if( pLower ) iLower = iUpper/2;
     }else if( pUpperVal==0 ){
       rc = whereRangeRegion(pParse, p, pLowerVal, &iLower);
-      iUpper = pUpper ? (iLower + SQLITE_INDEX_SAMPLES + 1)/2 
-                      : SQLITE_INDEX_SAMPLES;
+      if( pUpper ) iUpper = (iLower + SQLITE_INDEX_SAMPLES + 1)/2;
     }else{
       rc = whereRangeRegion(pParse, p, pUpperVal, &iUpper);
       if( rc==SQLITE_OK ){
         rc = whereRangeRegion(pParse, p, pLowerVal, &iLower);
-      }else{
-        iLower = 0;
       }
     }