Additional changes due to Coverity scans. (CVS 3130)

FossilOrigin-Name: a69f697d50124f2c0c654d56390ae83a4ac5e9e8
This commit is contained in:
drh 2006-03-13 12:54:09 +00:00
parent ff3b170023
commit 8aa34ae0b1
5 changed files with 26 additions and 21 deletions

View File

@ -1,5 +1,5 @@
C Add\san\sassert()\sto\sdemonstrate\sthat\sKlockworks\sis\swrong\sabout\san\saleged\sbug.\s(CVS\s3129)
D 2006-03-11T12:04:18
C Additional\schanges\sdue\sto\sCoverity\sscans.\s(CVS\s3130)
D 2006-03-13T12:54:10
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -36,7 +36,7 @@ F src/attach.c d73a3505de3fb9e373d0a158978116c4212031d0
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c 861f6a805b55dbf37a35a0561e0cf5e99ed073ae
F src/btree.h 40055cfc09defd1146bc5b922399c035f969e56d
F src/build.c 98b458e30906461777ff1e003eef2db14c37314f
F src/build.c 4bd8471e4f20f5623c15fd71d2aaee0f66e394d8
F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
@ -61,7 +61,7 @@ F src/os_win.c 8ced9ac82670bbf77492961a2f7ff80a87f1404f
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 7b1975e2fa56fc3c9859bec321f57cd3d75ec36b
F src/pager.h 43f32f3847421f7502cfbb66f4eb2302b8033818
F src/parse.y c2daaa24fa2c8e256af740f29d3d61ac552fbd49
F src/parse.y ee1887ce0e6eea15cc728913ad3462898f88e9b0
F src/pragma.c 27d5e395c5d950931c7ac4fe610e7c2993e2fa55
F src/prepare.c fe3f5b7524575d378e82d3d7d4f1371884087c4e
F src/printf.c 341e488b549b1a41f83b05a69ce1d7a8258b624c
@ -93,7 +93,7 @@ F src/vdbe.c 5fb9d3e64ed18f82e71bd2ff94c3e5f07384c7d4
F src/vdbe.h 80ba1c391ec28180dd07a630577f50b22c2062da
F src/vdbeInt.h 2109be6b58e3bfcd8e5b56d3b212b1a105a61051
F src/vdbeapi.c 7dc662e7c905ce666bb506dced932e0307115cbf
F src/vdbeaux.c e7f448c58de1115cecf1d1e0fbb707778b630e00
F src/vdbeaux.c db9dc285e1efacaece7ee6f9c2f5085e3700942e
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 5f0afe3b92bb2c037f8d5d697f7c151fa50783a3
F src/where.c 39af47e7f48be8df8a14a5965a38326bccf8eeed
@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 36830fafa405c9eae4795045efc6843394c67555
R 49e02133024179ffb0fdf1048751534a
P 0910022be3ec8ce540e0e6adce2eed7a7cd28fd3
R 3b0768980a7df91b35d6774b73d561d5
U drh
Z 526a9d7b9b1e35a7ab2038e1353a52ca
Z 43c825bec0d49c278c25514cf14fe00a

View File

@ -1 +1 @@
0910022be3ec8ce540e0e6adce2eed7a7cd28fd3
a69f697d50124f2c0c654d56390ae83a4ac5e9e8

View File

@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.390 2006/03/06 20:55:46 drh Exp $
** $Id: build.c,v 1.391 2006/03/13 12:54:10 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -3016,7 +3016,7 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
if( iDb>=0 ){
assert( iDb<db->nDb );
assert( db->aDb[iDb].pBt!=0 || iDb==1 );
assert( iDb<32 );
assert( iDb<MAX_ATTACHED+2 );
mask = 1<<iDb;
if( (pParse->cookieMask & mask)==0 ){
pParse->cookieMask |= mask;

View File

@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.198 2006/02/27 22:22:28 drh Exp $
** @(#) $Id: parse.y,v 1.199 2006/03/13 12:54:10 drh Exp $
*/
// All token codes are small integers with #defines that begin with "TK_"
@ -661,7 +661,7 @@ expr(A) ::= CAST(X) LP expr(E) AS typetoken(T) RP(Y). {
expr(A) ::= ID(X) LP distinct(D) exprlist(Y) RP(E). {
A = sqlite3ExprFunction(Y, &X);
sqlite3ExprSpan(A,&X,&E);
if( D ){
if( D && A ){
A->flags |= EP_Distinct;
}
}
@ -692,7 +692,8 @@ likeop(A) ::= NOT LIKE_KW(X). {A.eOperator = X; A.not = 1;}
escape(X) ::= ESCAPE expr(A). [ESCAPE] {X = A;}
escape(X) ::= . [ESCAPE] {X = 0;}
expr(A) ::= expr(X) likeop(OP) expr(Y) escape(E). [LIKE_KW] {
ExprList *pList = sqlite3ExprListAppend(0, Y, 0);
ExprList *pList;
pList = sqlite3ExprListAppend(0, Y, 0);
pList = sqlite3ExprListAppend(pList, X, 0);
if( E ){
pList = sqlite3ExprListAppend(pList, E, 0);
@ -985,13 +986,17 @@ trigger_cmd(A) ::= select(X). {A = sqlite3TriggerSelectStep(X); }
// The special RAISE expression that may occur in trigger programs
expr(A) ::= RAISE(X) LP IGNORE RP(Y). {
A = sqlite3Expr(TK_RAISE, 0, 0, 0);
A->iColumn = OE_Ignore;
sqlite3ExprSpan(A, &X, &Y);
if( A ){
A->iColumn = OE_Ignore;
sqlite3ExprSpan(A, &X, &Y);
}
}
expr(A) ::= RAISE(X) LP raisetype(T) COMMA nm(Z) RP(Y). {
A = sqlite3Expr(TK_RAISE, 0, 0, &Z);
A->iColumn = T;
sqlite3ExprSpan(A, &X, &Y);
if( A ) {
A->iColumn = T;
sqlite3ExprSpan(A, &X, &Y);
}
}
%endif // !SQLITE_OMIT_TRIGGER

View File

@ -340,7 +340,7 @@ int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
** few minor changes to the program.
*/
void sqlite3VdbeChangeP1(Vdbe *p, int addr, int val){
assert( p->magic==VDBE_MAGIC_INIT );
assert( p==0 || p->magic==VDBE_MAGIC_INIT );
if( p && addr>=0 && p->nOp>addr && p->aOp ){
p->aOp[addr].p1 = val;
}
@ -352,7 +352,7 @@ void sqlite3VdbeChangeP1(Vdbe *p, int addr, int val){
*/
void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){
assert( val>=0 );
assert( p->magic==VDBE_MAGIC_INIT );
assert( p==0 || p->magic==VDBE_MAGIC_INIT );
if( p && addr>=0 && p->nOp>addr && p->aOp ){
p->aOp[addr].p2 = val;
}
@ -420,7 +420,7 @@ static void freeP3(int p3type, void *p3){
*/
void sqlite3VdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){
Op *pOp;
assert( p->magic==VDBE_MAGIC_INIT );
assert( p==0 || p->magic==VDBE_MAGIC_INIT );
if( p==0 || p->aOp==0 || sqlite3MallocFailed() ){
if (n != P3_KEYINFO) {
freeP3(n, (void*)*(char**)&zP3);