aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2021-09-24 02:14:35 +0000
committerdrh <>2021-09-24 02:14:35 +0000
commit2a6a72a81cbd0df057be37e4ee514c68c7f64664 (patch)
tree64661cc5b34abdcc83d0da9807740fcc4e3e54a7 /src
parentdd31c033c602bc75d04c8b6470684d0506861d6b (diff)
downloadsqlite-2a6a72a81cbd0df057be37e4ee514c68c7f64664.tar.gz
sqlite-2a6a72a81cbd0df057be37e4ee514c68c7f64664.zip
Ensure that the db->init.azInit array is initialized at all times.
dbsqlfuzz 0ad6d441f9bf3dfc32626a9900bc1700495b16f9 FossilOrigin-Name: c7560c1329965ab57cd71393c044b110561b83641d08677bc51044df9e377882
Diffstat (limited to 'src')
-rw-r--r--src/main.c1
-rw-r--r--src/prepare.c3
-rw-r--r--src/sqliteInt.h2
3 files changed, 4 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index e0dcf3923..65fe4a668 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3205,6 +3205,7 @@ static int openDatabase(
db->nextAutovac = -1;
db->szMmap = sqlite3GlobalConfig.szMmap;
db->nextPagesize = 0;
+ db->init.azInit = sqlite3StdType; /* Any array of string ptrs will do */
#ifdef SQLITE_ENABLE_SORTER_MMAP
/* Beginning with version 3.37.0, using the VFS xFetch() API to memory-map
** the temporary files used to do external sorts (see code in vdbesort.c)
diff --git a/src/prepare.c b/src/prepare.c
index 6dcb3842e..62dca01b6 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -134,7 +134,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
}
}
db->init.orphanTrigger = 0;
- db->init.azInit = argv;
+ db->init.azInit = (const char**)argv;
pStmt = 0;
TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0);
rc = db->errCode;
@@ -153,6 +153,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
}
}
}
+ db->init.azInit = sqlite3StdType; /* Any array of string ptrs will do */
sqlite3_finalize(pStmt);
}else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){
corruptSchema(pData, argv, 0);
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index d10d02f74..dd19131fc 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1546,7 +1546,7 @@ struct sqlite3 {
unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
unsigned imposterTable : 1; /* Building an imposter table */
unsigned reopenMemdb : 1; /* ATTACH is really a reopen using MemDB */
- char **azInit; /* "type", "name", and "tbl_name" columns */
+ const char **azInit; /* "type", "name", and "tbl_name" columns */
} init;
int nVdbeActive; /* Number of VDBEs currently running */
int nVdbeRead; /* Number of active VDBEs that read or write */