mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Clear up another zero-length array. This seems to fix the segfault in
func-13.4 too. (CVS 1641) FossilOrigin-Name: 70680a34b4b617286d92730bd3042b8b569b3371
This commit is contained in:
20
manifest
20
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\sproblems\swith\sthe\sWatCom\sC\scompiler:\s\sArrays\smust\scontain\sat\sleast\sone\nelement.\s\ssqlite3FreeX\sdeclared\sproperly.\s\sDon't\sallow\srun-time\sexpression\n(the\sSQLITE_UTF16NATIVE\smacro)\sin\san\sarray\sinitializer.\s(CVS\s1640)
|
||||
D 2004-06-19T15:22:56
|
||||
C Clear\sup\sanother\szero-length\sarray.\s\sThis\sseems\sto\sfix\sthe\ssegfault\sin\nfunc-13.4\stoo.\s(CVS\s1641)
|
||||
D 2004-06-19T15:40:23
|
||||
F Makefile.in d69d53c543518c1572ee0a8e8723d7e00bdb2266
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@@ -33,7 +33,7 @@ F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1
|
||||
F src/delete.c a5191011b7429dff939df631b8bdcc1714b8d7aa
|
||||
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
|
||||
F src/expr.c 9ae0e55a230802da35a55fd6e87533cca0301af9
|
||||
F src/func.c b7a8b55200d34bf01fe2a52462db27399f291777
|
||||
F src/func.c 21985e3b20749a18fdf3ae77b455815f730be0b9
|
||||
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
|
||||
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
|
||||
F src/insert.c 1428887f4a7515a7d34e82aaeb76297c79ba378b
|
||||
@@ -71,11 +71,11 @@ F src/update.c f9a03233577e0c3d57234d1957963875fc941da2
|
||||
F src/utf.c 3a2596013e4b9582d075ca742de7f067ff7dee95
|
||||
F src/util.c 1b3743413e11cae51a899dc03fa9b829a3a1f160
|
||||
F src/vacuum.c fcb930215a3f6c50087300782555f61ad11dd80c
|
||||
F src/vdbe.c 324ad6157f9bd0a770be70a4e7dca2cb0d27bd82
|
||||
F src/vdbe.c 3931b2e4dfb23c8808fb4efc4880dda08c8915ad
|
||||
F src/vdbe.h 9ad64674c4c7acd6744174cab5d34013413ef0d3
|
||||
F src/vdbeInt.h e472de98c61e9e183402bfa00542e0abd26e825c
|
||||
F src/vdbeapi.c 2163463b13468b2b8651fbf71a2b8548ea071e37
|
||||
F src/vdbeaux.c cf9caac1163ea384e49b11cb0d405082eef8741d
|
||||
F src/vdbeInt.h d007ccada5e3043816097242a560ed6c7f6483ce
|
||||
F src/vdbeapi.c 0ef00cd2a3764363e957f8e9c6bc90d12989ee3a
|
||||
F src/vdbeaux.c d2d95f1b9341bd3861e5229cb24a821715824449
|
||||
F src/vdbemem.c 9359c53386e070fea9f5403cab0c6f0cfe36496b
|
||||
F src/where.c 6507074d8ce3f78e7a4cd33f667f11e62020553e
|
||||
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
||||
@@ -225,7 +225,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl af528563442e3039928f9018327a18157e53a44f
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 99d0436e0ee1c917b2b7bbf005f05288b535648a
|
||||
R db0065ad2b92a7ca2b665309ece9eeec
|
||||
P fbfc3c95a8abf25bb9e2b44cfeb7186c5b0591d7
|
||||
R 8b1896930be175cc145ac47aedd2f4cb
|
||||
U drh
|
||||
Z 991debb39d796778891cff3d4f612b44
|
||||
Z 4a06f27d3dc21ce0ad6cfd96c4ae0233
|
||||
|
@@ -1 +1 @@
|
||||
fbfc3c95a8abf25bb9e2b44cfeb7186c5b0591d7
|
||||
70680a34b4b617286d92730bd3042b8b569b3371
|
@@ -16,7 +16,7 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.72 2004/06/19 08:18:09 danielk1977 Exp $
|
||||
** $Id: func.c,v 1.73 2004/06/19 15:40:23 drh Exp $
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
@@ -308,7 +308,7 @@ struct LikePattern {
|
||||
struct LikeState {
|
||||
int val; /* Unicode codepoint or -1 for any char i.e. '_' */
|
||||
int failstate; /* State to jump to if next char is not val */
|
||||
} aState[0];
|
||||
} aState[1];
|
||||
};
|
||||
typedef struct LikePattern LikePattern;
|
||||
|
||||
@@ -1093,4 +1093,3 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){
|
||||
}
|
||||
sqlite3RegisterDateTimeFunctions(db);
|
||||
}
|
||||
|
||||
|
13
src/vdbe.c
13
src/vdbe.c
@@ -43,7 +43,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.380 2004/06/19 09:35:37 danielk1977 Exp $
|
||||
** $Id: vdbe.c,v 1.381 2004/06/19 15:40:23 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -1309,16 +1309,7 @@ case OP_Function: {
|
||||
** immediately call the destructor for any non-static values.
|
||||
*/
|
||||
if( ctx.pVdbeFunc ){
|
||||
int mask = pOp->p2;
|
||||
for(i=0; i<ctx.pVdbeFunc->nAux; i++){
|
||||
struct AuxData *pAux = &ctx.pVdbeFunc->apAux[i];
|
||||
if( (i>31 || !(mask&(1<<i))) && pAux->pAux ){
|
||||
if( pAux->xDelete ){
|
||||
pAux->xDelete(pAux->pAux);
|
||||
}
|
||||
pAux->pAux = 0;
|
||||
}
|
||||
}
|
||||
sqlite3VdbeDeleteAuxData(ctx.pVdbeFunc, pOp->p2);
|
||||
pOp->p3 = (char *)ctx.pVdbeFunc;
|
||||
pOp->p3type = P3_VDBEFUNC;
|
||||
}
|
||||
|
@@ -373,6 +373,7 @@ int sqlite3VdbeSerialTypeLen(u32);
|
||||
u32 sqlite3VdbeSerialType(Mem*);
|
||||
int sqlite3VdbeSerialPut(unsigned char*, Mem*);
|
||||
int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
|
||||
void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);
|
||||
|
||||
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
|
||||
int sqlite3VdbeIdxKeyCompare(Cursor*, int , const unsigned char*, int*);
|
||||
|
@@ -218,7 +218,7 @@ void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
|
||||
if( !pVdbeFunc || iArg>=pVdbeFunc->nAux || iArg<0 ){
|
||||
return 0;
|
||||
}
|
||||
return pCtx->pVdbeFunc->apAux[iArg].pAux;
|
||||
return pVdbeFunc->apAux[iArg].pAux;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -233,18 +233,19 @@ void sqlite3_set_auxdata(
|
||||
void (*xDelete)(void*)
|
||||
){
|
||||
struct AuxData *pAuxData;
|
||||
VdbeFunc *pVdbeFunc;
|
||||
if( iArg<0 ) return;
|
||||
|
||||
if( !pCtx->pVdbeFunc || pCtx->pVdbeFunc->nAux<=iArg ){
|
||||
VdbeFunc *pVdbeFunc;
|
||||
pVdbeFunc = pCtx->pVdbeFunc;
|
||||
if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){
|
||||
int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg;
|
||||
pCtx->pVdbeFunc = pVdbeFunc = sqliteRealloc(pCtx->pVdbeFunc, nMalloc);
|
||||
pCtx->pVdbeFunc = pVdbeFunc = sqliteRealloc(pVdbeFunc, nMalloc);
|
||||
if( !pVdbeFunc ) return;
|
||||
pVdbeFunc->nAux = iArg+1;
|
||||
pVdbeFunc->pFunc = pCtx->pFunc;
|
||||
}
|
||||
|
||||
pAuxData = &pCtx->pVdbeFunc->apAux[iArg];
|
||||
pAuxData = &pVdbeFunc->apAux[iArg];
|
||||
if( pAuxData->pAux && pAuxData->xDelete ){
|
||||
pAuxData->xDelete(pAuxData->pAux);
|
||||
}
|
||||
|
@@ -1309,6 +1309,25 @@ int sqlite3VdbeFinalize(Vdbe *p, char **pzErrMsg){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Call the destructor for each auxdata entry in pVdbeFunc for which
|
||||
** the corresponding bit in mask is set. Auxdata entries beyond 31
|
||||
** are always destroyed. To destroy all auxdata entries, call this
|
||||
** routine with mask==-1.
|
||||
*/
|
||||
void sqlite3VdbeDeleteAuxData(VdbeFunc *pVdbeFunc, int mask){
|
||||
int i;
|
||||
for(i=0; i<pVdbeFunc->nAux; i++){
|
||||
struct AuxData *pAux = &pVdbeFunc->apAux[i];
|
||||
if( (i>31 || !(mask&(1<<i))) && pAux->pAux ){
|
||||
if( pAux->xDelete ){
|
||||
pAux->xDelete(pAux->pAux);
|
||||
}
|
||||
pAux->pAux = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Delete an entire VDBE.
|
||||
*/
|
||||
@@ -1338,12 +1357,7 @@ void sqlite3VdbeDelete(Vdbe *p){
|
||||
if( pOp->p3type==P3_VDBEFUNC ){
|
||||
int j;
|
||||
VdbeFunc *pVdbeFunc = (VdbeFunc *)pOp->p3;
|
||||
for(j=0; j<pVdbeFunc->nAux; j++){
|
||||
struct AuxData *pAuxData = &pVdbeFunc->apAux[j];
|
||||
if( pAuxData->pAux && pAuxData->xDelete ){
|
||||
pAuxData->xDelete(pAuxData->pAux);
|
||||
}
|
||||
}
|
||||
sqlite3VdbeDeleteAuxData(pVdbeFunc, -1);
|
||||
sqliteFree(pVdbeFunc);
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
|
Reference in New Issue
Block a user