]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid reading the -1-th element of an array in the query planner. Fix to a
authordrh <drh@noemail.net>
Wed, 12 Oct 2016 18:55:53 +0000 (18:55 +0000)
committerdrh <drh@noemail.net>
Wed, 12 Oct 2016 18:55:53 +0000 (18:55 +0000)
bug introduced by check-in [8e2b25f9b8a7] from earlier today.  Curiously,
the problem only appeared on 32-bit systems.

FossilOrigin-Name: 443913d582bcd953d85159047541592e2f68ade3

manifest
manifest.uuid
src/where.c

index 241e0db8a7529ff06ed9982eea90229b76f6301b..9719134aaaa2bdb0997a3de6d789164744adc70f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sto\ssqlite3_analyzer\scommand-line\soptions\s--version\sand\s--tclsh,\sand\salso\nthe\sundocumented\s--debug\soption.
-D 2016-10-12T18:26:26.364
+C Avoid\sreading\sthe\s-1-th\selement\sof\san\sarray\sin\sthe\squery\splanner.\s\sFix\sto\sa\nbug\sintroduced\sby\scheck-in\s[8e2b25f9b8a7]\sfrom\searlier\stoday.\s\sCuriously,\nthe\sproblem\sonly\sappeared\son\s32-bit\ssystems.
+D 2016-10-12T18:55:53.185
 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
@@ -467,7 +467,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
 F src/wal.c 02eeecc265f6ffd0597378f5d8ae9070b62a406a
 F src/wal.h 6dd221ed384afdc204bc61e25c23ef7fd5a511f2
 F src/walker.c 91a6df7435827e41cff6bb7df50ea00934ee78b0
-F src/where.c 7e454887a70a8263f663eab8c9d0f6ecc8ec7ac7
+F src/where.c 5f846d94bb3d35b3146d9915eb301ee362957b0a
 F src/whereInt.h 2bcc3d176e6091cb8f50a30b65c006e88a73614d
 F src/wherecode.c 717a65294df46f30e9b9933d2a63a4bcbca5a9a8
 F src/whereexpr.c 379d0017fb7bc9e5a4d8cd4b056c747de946430e
@@ -1525,7 +1525,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 61f0526978af667781c57bcc87510e4524efd0d8
-R 939be1793993bb5a0733cfe788e02f4d
+P e87d02d289a2016ea3ee074e914b07a8ac22b21f
+R 347ceac05d5e830be9b0b453b9055752
 U drh
-Z 3046f41ed5ee9baf8f6c825aaff1459e
+Z f6a48b076f4d91846fe2072e2532d39d
index ceae9890fc0e30e057efd3cd0acdc9dabd96823e..f1cc7550cb8397fc6ca85f87396ad233e603777e 100644 (file)
@@ -1 +1 @@
-e87d02d289a2016ea3ee074e914b07a8ac22b21f
\ No newline at end of file
+443913d582bcd953d85159047541592e2f68ade3
\ No newline at end of file
index 443e9ea82df84c1eed42989da045744bb4d3fd5f..c75eb943f3f202a33aa3f4cf755dad437137b104 100644 (file)
@@ -4123,19 +4123,21 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
       pWInfo->nOBSat = pFrom->isOrdered;
       pWInfo->revMask = pFrom->revLoop;
       if( pWInfo->nOBSat<=0 ){
-        u32 wsFlags = pFrom->aLoop[nLoop-1]->wsFlags;
         pWInfo->nOBSat = 0;
-        if( nLoop>0 && (wsFlags & WHERE_ONEROW)==0 
-         && (wsFlags & (WHERE_IPK|WHERE_COLUMN_IN))!=(WHERE_IPK|WHERE_COLUMN_IN)
-        ){
-          Bitmask m = 0;
-          int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom,
+        if( nLoop>0 ){
+          u32 wsFlags = pFrom->aLoop[nLoop-1]->wsFlags;
+          if( (wsFlags & WHERE_ONEROW)==0 
+           && (wsFlags&(WHERE_IPK|WHERE_COLUMN_IN))!=(WHERE_IPK|WHERE_COLUMN_IN)
+          ){
+            Bitmask m = 0;
+            int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom,
                       WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m);
-          testcase( wsFlags & WHERE_IPK );
-          testcase( wsFlags & WHERE_COLUMN_IN );
-          if( rc==pWInfo->pOrderBy->nExpr ){
-            pWInfo->bOrderedInnerLoop = 1;
-            pWInfo->revMask = m;
+            testcase( wsFlags & WHERE_IPK );
+            testcase( wsFlags & WHERE_COLUMN_IN );
+            if( rc==pWInfo->pOrderBy->nExpr ){
+              pWInfo->bOrderedInnerLoop = 1;
+              pWInfo->revMask = m;
+            }
           }
         }
       }