]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the PopStack() routine so that it doesn't confuse bounds checkers.
authordrh <drh@noemail.net>
Sun, 12 Jan 2003 17:28:19 +0000 (17:28 +0000)
committerdrh <drh@noemail.net>
Sun, 12 Jan 2003 17:28:19 +0000 (17:28 +0000)
Ticket #222. (CVS 825)

FossilOrigin-Name: fc11fa50b8f39f5e0b3674d7df832ffbca0d948f

manifest
manifest.uuid
src/vdbe.c

index 8bb665adb4080c66d1aea81d10e73b8eda544bef..6bd9c7246b63dc37024d4f48770770bf083c128a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sthe\saOrder()\sarray\sfrom\swhere.c.\s(CVS\s824)
-D 2003-01-11T15:02:45
+C Change\sthe\sPopStack()\sroutine\sso\sthat\sit\sdoesn't\sconfuse\sbounds\scheckers.\nTicket\s#222.\s(CVS\s825)
+D 2003-01-12T17:28:19
 F Makefile.in 868c17a1ae1c07603d491274cc8f86c04acf2a1e
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -52,7 +52,7 @@ F src/tokenize.c 7ac1c33e0149647c9eb5959c48992df6906d4809
 F src/trigger.c 5ba917fc226b96065108da28186c2efaec53e481
 F src/update.c ab3182eae676d7f198354df6a54e8611aac6ae9c
 F src/util.c e2d108842e02810d3d3242cac0e024b09cdb3c4a
-F src/vdbe.c e1f66bb2f56bf3cd974d5a385bfd03ace5c108a5
+F src/vdbe.c 1585e3aadbf401d65195c2a6e9005a3fb4a9b7a2
 F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55
 F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18
 F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
@@ -152,7 +152,7 @@ F www/speed.tcl a20a792738475b68756ea7a19321600f23d1d803
 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 4c22da76ca91f3c59dac1c529e82ac3b04b767bd
-R 4a2b6f4541d31472e460c1ba1de18bd4
+P b2c1edb47f481cafe6718bafcdb517cca160a44d
+R 99e985ad455a114f0a0f01e3c1b1611a
 U drh
-Z a470dc03da337ece1ad70e48af485f54
+Z 729883f7b08f09197c247d0cde63e890
index 1e2a39e249ed8a3adee416f56944e68d5feb6318..3b30e7f630ea35ddbb7e9ec721ba0f8a3311c5e0 100644 (file)
@@ -1 +1 @@
-b2c1edb47f481cafe6718bafcdb517cca160a44d
\ No newline at end of file
+fc11fa50b8f39f5e0b3674d7df832ffbca0d948f
\ No newline at end of file
index 90aa8c9406a52ea2cfcca896fcfcef0149baaecd..49f460d3a9eb91a84b30dc98abb61469d75e6a4d 100644 (file)
@@ -36,7 +36,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.195 2003/01/11 13:30:58 drh Exp $
+** $Id: vdbe.c,v 1.196 2003/01/12 17:28:19 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -926,20 +926,16 @@ static void hardRealify(Vdbe *p, int i){
 ** popped stack elements.
 */
 static void PopStack(Vdbe *p, int N){
-  char **pzStack;
-  Stack *pStack;
+  assert( N>=0 );
   if( p->zStack==0 ) return;
-  pStack = &p->aStack[p->tos];
-  pzStack = &p->zStack[p->tos];
-  p->tos -= N;
+  assert( p->aStack );
   while( N-- > 0 ){
-    if( pStack->flags & STK_Dyn ){
-      sqliteFree(*pzStack);
+    if( p->aStack[p->tos].flags & STK_Dyn ){
+      sqliteFree(p->zStack[p->tos]);
     }
-    pStack->flags = 0;
-    *pzStack = 0;
-    pStack--;
-    pzStack--;
+    p->aStack[p->tos].flags = 0;
+    p->zStack[p->tos] = 0;
+    p->tos--;
   }
 }
 
@@ -949,8 +945,9 @@ static void PopStack(Vdbe *p, int N){
 ** function.
 */
 #define POPSTACK \
- if( aStack[p->tos].flags & STK_Dyn ) sqliteFree(zStack[p->tos]); \
- p->tos--;
+  assert(p->tos>=0); \
+  if( aStack[p->tos].flags & STK_Dyn ) sqliteFree(zStack[p->tos]); \
+  p->tos--;
 
 /*
 ** Return TRUE if zNum is a floating-point or integer number.
@@ -1397,7 +1394,6 @@ int sqliteVdbeExec(
   int origPc;
 #endif
 
-
   /* No instruction ever pushes more than a single element onto the
   ** stack.  And the stack never grows on successive executions of the
   ** same loop.  So the total number of instructions is an upper bound