1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Change the PopStack() routine so that it doesn't confuse bounds checkers.

Ticket #222. (CVS 825)

FossilOrigin-Name: fc11fa50b8f39f5e0b3674d7df832ffbca0d948f
This commit is contained in:
drh
2003-01-12 17:28:19 +00:00
parent fa9e0df21b
commit f27134cdc4
3 changed files with 18 additions and 22 deletions

View File

@ -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

View File

@ -1 +1 @@
b2c1edb47f481cafe6718bafcdb517cca160a44d
fc11fa50b8f39f5e0b3674d7df832ffbca0d948f

View 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,6 +945,7 @@ static void PopStack(Vdbe *p, int N){
** function.
*/
#define POPSTACK \
assert(p->tos>=0); \
if( aStack[p->tos].flags & STK_Dyn ) sqliteFree(zStack[p->tos]); \
p->tos--;
@ -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