Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Clear up another zero-length array. This seems to fix the segfault in func-13.4 too. (CVS 1641) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
70680a34b4b617286d92730bd3042b8b |
User & Date: | drh 2004-06-19 15:40:23.000 |
Context
2004-06-19
| ||
16:06 | Omit the DB_Locked and DB_Cookie flags. Other minor cleanup. (CVS 1642) (check-in: 01f74b420c user: drh tags: trunk) | |
15:40 | Clear up another zero-length array. This seems to fix the segfault in func-13.4 too. (CVS 1641) (check-in: 70680a34b4 user: drh tags: trunk) | |
15:22 | Fix problems with the WatCom C compiler: Arrays must contain at least one element. sqlite3FreeX declared properly. Don't allow run-time expression (the SQLITE_UTF16NATIVE macro) in an array initializer. (CVS 1640) (check-in: fbfc3c95a8 user: drh tags: trunk) | |
Changes
Changes to src/func.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** ** $Id: func.c,v 1.73 2004/06/19 15:40:23 drh Exp $ */ #include <ctype.h> #include <math.h> #include <stdlib.h> #include <assert.h> #include "sqliteInt.h" #include "vdbeInt.h" |
︙ | ︙ | |||
304 305 306 307 308 309 310 | ** to the comment for compileLike() function for details. */ struct LikePattern { int nState; 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 */ | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | ** to the comment for compileLike() function for details. */ struct LikePattern { int nState; 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[1]; }; typedef struct LikePattern LikePattern; void deleteLike(void *pLike){ sqliteFree(pLike); } |
︙ | ︙ | |||
1089 1090 1091 1092 1093 1094 1095 | if( pFunc && aAggs[i].needCollSeq ){ pFunc->needCollSeq = 1; } } } sqlite3RegisterDateTimeFunctions(db); } | < | 1089 1090 1091 1092 1093 1094 1095 | if( pFunc && aAggs[i].needCollSeq ){ pFunc->needCollSeq = 1; } } } sqlite3RegisterDateTimeFunctions(db); } |
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** 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.381 2004/06/19 15:40:23 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
1305 1306 1307 1308 1309 1310 1311 | if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse; popStack(&pTos, n); /* If any auxilary data functions have been called by this user function, ** immediately call the destructor for any non-static values. */ if( ctx.pVdbeFunc ){ | < | < < < < < < < < | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 | if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse; popStack(&pTos, n); /* If any auxilary data functions have been called by this user function, ** immediately call the destructor for any non-static values. */ if( ctx.pVdbeFunc ){ sqlite3VdbeDeleteAuxData(ctx.pVdbeFunc, pOp->p2); pOp->p3 = (char *)ctx.pVdbeFunc; pOp->p3type = P3_VDBEFUNC; } /* Copy the result of the function to the top of the stack */ pTos++; *pTos = ctx.s; |
︙ | ︙ |
Changes to src/vdbeInt.h.
︙ | ︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 | #if !defined(NDEBUG) || defined(VDBE_PROFILE) void sqlite3VdbePrintOp(FILE*, int, Op*); #endif int sqlite3VdbeSerialTypeLen(u32); u32 sqlite3VdbeSerialType(Mem*); int sqlite3VdbeSerialPut(unsigned char*, Mem*); int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); int sqlite3VdbeIdxKeyCompare(Cursor*, int , const unsigned char*, int*); int sqlite3VdbeIdxRowid(BtCursor *, i64 *); int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); int sqlite3VdbeRecordCompare(void*,int,const void*,int, const void*); int sqlite3VdbeIdxRowidLen(int,const u8*); | > | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | #if !defined(NDEBUG) || defined(VDBE_PROFILE) void sqlite3VdbePrintOp(FILE*, int, Op*); #endif 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*); int sqlite3VdbeIdxRowid(BtCursor *, i64 *); int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); int sqlite3VdbeRecordCompare(void*,int,const void*,int, const void*); int sqlite3VdbeIdxRowidLen(int,const u8*); |
︙ | ︙ |
Changes to src/vdbeapi.c.
︙ | ︙ | |||
214 215 216 217 218 219 220 | ** the user-function defined by pCtx. */ void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ VdbeFunc *pVdbeFunc = pCtx->pVdbeFunc; if( !pVdbeFunc || iArg>=pVdbeFunc->nAux || iArg<0 ){ return 0; } | | > | | | | | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | ** the user-function defined by pCtx. */ void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ VdbeFunc *pVdbeFunc = pCtx->pVdbeFunc; if( !pVdbeFunc || iArg>=pVdbeFunc->nAux || iArg<0 ){ return 0; } return pVdbeFunc->apAux[iArg].pAux; } /* ** Set the auxilary data pointer and delete function, for the iArg'th ** argument to the user-function defined by pCtx. Any previous value is ** deleted by calling the delete function specified when it was set. */ void sqlite3_set_auxdata( sqlite3_context *pCtx, int iArg, void *pAux, void (*xDelete)(void*) ){ struct AuxData *pAuxData; VdbeFunc *pVdbeFunc; if( iArg<0 ) return; pVdbeFunc = pCtx->pVdbeFunc; if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){ int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg; pCtx->pVdbeFunc = pVdbeFunc = sqliteRealloc(pVdbeFunc, nMalloc); if( !pVdbeFunc ) return; pVdbeFunc->nAux = iArg+1; pVdbeFunc->pFunc = pCtx->pFunc; } pAuxData = &pVdbeFunc->apAux[iArg]; if( pAuxData->pAux && pAuxData->xDelete ){ pAuxData->xDelete(pAuxData->pAux); } pAuxData->pAux = pAux; pAuxData->xDelete = xDelete; } |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | rc = sqlite3VdbeReset(p, pzErrMsg); sqlite3VdbeDelete(p); if( rc==SQLITE_SCHEMA ){ sqlite3ResetInternalSchema(db, 0); } return rc; } /* ** Delete an entire VDBE. */ void sqlite3VdbeDelete(Vdbe *p){ int i; if( p==0 ) return; | > > > > > > > > > > > > > > > > > > > | 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | rc = sqlite3VdbeReset(p, pzErrMsg); sqlite3VdbeDelete(p); if( rc==SQLITE_SCHEMA ){ sqlite3ResetInternalSchema(db, 0); } 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. */ void sqlite3VdbeDelete(Vdbe *p){ int i; if( p==0 ) return; |
︙ | ︙ | |||
1334 1335 1336 1337 1338 1339 1340 | Op *pOp = &p->aOp[i]; if( pOp->p3type==P3_DYNAMIC || pOp->p3type==P3_KEYINFO ){ sqliteFree(pOp->p3); } if( pOp->p3type==P3_VDBEFUNC ){ int j; VdbeFunc *pVdbeFunc = (VdbeFunc *)pOp->p3; | | < < < < < | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 | Op *pOp = &p->aOp[i]; if( pOp->p3type==P3_DYNAMIC || pOp->p3type==P3_KEYINFO ){ sqliteFree(pOp->p3); } if( pOp->p3type==P3_VDBEFUNC ){ int j; VdbeFunc *pVdbeFunc = (VdbeFunc *)pOp->p3; sqlite3VdbeDeleteAuxData(pVdbeFunc, -1); sqliteFree(pVdbeFunc); } #ifndef NDEBUG sqliteFree(pOp->zComment); #endif } for(i=0; i<p->nVar; i++){ |
︙ | ︙ |