]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove unreachable condition from btree.c. (CVS 6876)
authordanielk1977 <danielk1977@noemail.net>
Sat, 11 Jul 2009 05:06:51 +0000 (05:06 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 11 Jul 2009 05:06:51 +0000 (05:06 +0000)
FossilOrigin-Name: 47b40fefa67f7c563ce2004509aaf8e203038be4

manifest
manifest.uuid
src/btree.c

index d62d7af77e5a93d7283b6d71195c51fa1fd4226f..6768c53bd85e66c7ad5dce7684d85db06e98d2f7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\spager\sreference\scount\sleak\sin\sbtree\sthat\soccurs\son\san\sOOM\sfollowing\na\sdatabase\spage\ssize\schange.\s(CVS\s6875)
-D 2009-07-10T16:51:30
+C Remove\sunreachable\scondition\sfrom\sbtree.c.\s(CVS\s6876)
+D 2009-07-11T05:06:52
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
 F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
 F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
 F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
-F src/btree.c c331cc043d09a0549d27935ea967f15ca2e40bb7
+F src/btree.c 563cda7bbb92ff33c0e5b2fda589e6b59f89d5ed
 F src/btree.h e53a10fd31d16c60a86f03c9467a6f470aa3683b
 F src/btreeInt.h a568bf057aa249eb06fd31358b4393a5ac88c118
 F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P c19d419e8cf94a26d9bb6ad478e84841168a882e
-R 900a86651c078a633f311561d3c6050e
-U drh
-Z 239e27b725612da3876ba9121cd3d170
+P c6dfc8bd3911b4c93969bfc13d9931965feed674
+R 1f4a85e569a3fef8a6b8dcd856752a00
+U danielk1977
+Z f0c4a06ecb3adf98288d0a45bb531f00
index 8c4717e1eae666fd1728a48a93dff9ece162e723..13ef29a290b156770018b3045c8003c7aa3b7d67 100644 (file)
@@ -1 +1 @@
-c6dfc8bd3911b4c93969bfc13d9931965feed674
\ No newline at end of file
+47b40fefa67f7c563ce2004509aaf8e203038be4
\ No newline at end of file
index 3e00ccc56d3036ad3760b194dddf08ae841f2ba9..44259af3ca18649d8bce47a004b18a03acff0545 100644 (file)
@@ -9,7 +9,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: btree.c,v 1.674 2009/07/10 16:51:30 drh Exp $
+** $Id: btree.c,v 1.675 2009/07/11 05:06:52 danielk1977 Exp $
 **
 ** This file implements a external (disk-based) database using BTrees.
 ** See the header comment on "btreeInt.h" for additional information.
@@ -4218,6 +4218,7 @@ int sqlite3BtreeMovetoUnpacked(
   }
   assert( pCur->apPage[pCur->iPage] );
   assert( pCur->apPage[pCur->iPage]->isInit );
+  assert( pCur->apPage[pCur->iPage]->nCell>0 || pCur->eState==CURSOR_INVALID );
   if( pCur->eState==CURSOR_INVALID ){
     *pRes = -1;
     assert( pCur->apPage[pCur->iPage]->nCell==0 );
@@ -4228,10 +4229,16 @@ int sqlite3BtreeMovetoUnpacked(
     int lwr, upr;
     Pgno chldPg;
     MemPage *pPage = pCur->apPage[pCur->iPage];
-    int c = -1;  /* pRes return if table is empty must be -1 */
+    int c;
+
+    /* pPage->nCell must be greater than zero. If this is the root-page
+    ** the cursor would have been INVALID above and this for(;;) loop
+    ** not run. If this is not the root-page, then the moveToChild() routine
+    ** would have already detected db corruption.  */
+    assert( pPage->nCell>0 );
     lwr = 0;
     upr = pPage->nCell-1;
-    if( (!pPage->intKey && pIdxKey==0) || upr<0 ){
+    if( (!pPage->intKey && pIdxKey==0) ){
       rc = SQLITE_CORRUPT_BKPT;
       goto moveto_finish;
     }