1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Fix a problem whereby the *ppVtab output buffer passed to sqlite3_module.xConstruct() could be invalidated (freed) if a malloc() failure occured within a call to sqlite3_declare_vtab(). (CVS 4397)

FossilOrigin-Name: efd61df1b9170f0134787ae17ac996a7eff64add
This commit is contained in:
danielk1977
2007-09-04 15:38:57 +00:00
parent 7c836f06d3
commit 5bccfc95b1
3 changed files with 11 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
C Add\sinternal\slocking\sto\sthe\stest_async.c\sbackend.\sSo\sthat\smore\sthan\sone\sconnection\smay\sbe\sused\sfrom\swithin\sa\ssingle\sprocess.\s(CVS\s4396) C Fix\sa\sproblem\swhereby\sthe\s*ppVtab\soutput\sbuffer\spassed\sto\ssqlite3_module.xConstruct()\scould\sbe\sinvalidated\s(freed)\sif\sa\smalloc()\sfailure\soccured\swithin\sa\scall\sto\ssqlite3_declare_vtab().\s(CVS\s4397)
D 2007-09-04T14:31:47 D 2007-09-04T15:38:58
F Makefile.in cbfb898945536a8f9ea8b897e1586dd1fdbcc5db F Makefile.in cbfb898945536a8f9ea8b897e1586dd1fdbcc5db
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -170,7 +170,7 @@ F src/vdbeaux.c e35c851e3c1d18a7b90dbe35ae5e0fc9419a4ed4
F src/vdbeblob.c 82f51cdf9b0c0af729732fde48c824e498c0a1ca F src/vdbeblob.c 82f51cdf9b0c0af729732fde48c824e498c0a1ca
F src/vdbefifo.c 334c838c8f42d61a94813d136019ee566b5dc2f6 F src/vdbefifo.c 334c838c8f42d61a94813d136019ee566b5dc2f6
F src/vdbemem.c 246d434fa60bde6553490eb686adfd86adcd6712 F src/vdbemem.c 246d434fa60bde6553490eb686adfd86adcd6712
F src/vtab.c ace9b41a088f6ad55d2e39084d92180a2bee3276 F src/vtab.c 6776605198e0b844391335f1b77e3595b3616331
F src/where.c 4687a2a56bc0fe66ad457958ea9f72b6cae17426 F src/where.c 4687a2a56bc0fe66ad457958ea9f72b6cae17426
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@@ -569,7 +569,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 63ca02a5b2700858f0eceadc9b58b942d473b191 P 17ca684c124445f17d1e36c37e169056c5fd4569
R 5cb983fe15fecf887cd0939edebbb838 R aab5e4f24ec35c5749ccbfc9ee626576
U danielk1977 U danielk1977
Z 34bdd4fc38cb5e365ec1bd9364840893 Z d2e7e7e0b743acfcb2048b0ee18425ea

View File

@@ -1 +1 @@
17ca684c124445f17d1e36c37e169056c5fd4569 efd61df1b9170f0134787ae17ac996a7eff64add

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to help implement virtual tables. ** This file contains code used to help implement virtual tables.
** **
** $Id: vtab.c,v 1.56 2007/08/29 14:06:23 danielk1977 Exp $ ** $Id: vtab.c,v 1.57 2007/09/04 15:38:58 danielk1977 Exp $
*/ */
#ifndef SQLITE_OMIT_VIRTUALTABLE #ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -343,7 +343,7 @@ static int vtabCallConstructor(
){ ){
int rc; int rc;
int rc2; int rc2;
sqlite3_vtab *pVtab; sqlite3_vtab *pVtab = 0;
const char *const*azArg = (const char *const*)pTab->azModuleArg; const char *const*azArg = (const char *const*)pTab->azModuleArg;
int nArg = pTab->nModuleArg; int nArg = pTab->nModuleArg;
char *zErr = 0; char *zErr = 0;
@@ -359,12 +359,12 @@ static int vtabCallConstructor(
db->pVTab = pTab; db->pVTab = pTab;
rc = sqlite3SafetyOff(db); rc = sqlite3SafetyOff(db);
assert( rc==SQLITE_OK ); assert( rc==SQLITE_OK );
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pTab->pVtab, &zErr); rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVtab, &zErr);
rc2 = sqlite3SafetyOn(db); rc2 = sqlite3SafetyOn(db);
pVtab = pTab->pVtab;
if( rc==SQLITE_OK && pVtab ){ if( rc==SQLITE_OK && pVtab ){
pVtab->pModule = pMod->pModule; pVtab->pModule = pMod->pModule;
pVtab->nRef = 1; pVtab->nRef = 1;
pTab->pVtab = pVtab;
} }
if( SQLITE_OK!=rc ){ if( SQLITE_OK!=rc ){