Update fuzzcheck so that with the --load-dbsql options it screens its
inputs to ensure that they are valid dbsqlfuzz cases. Add new dbsqlfuzz finds to the test/fuzzdata8.db database. FossilOrigin-Name: 004f7d9bbeee049c22a7e1c82c6cc0ea79a237967de3ff57686acea3060d5f45
This commit is contained in:
parent
e6a9efb976
commit
e5da9356e0
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Ensure\sthat\sthe\sbtree\scursor\sis\scorrectly\sset\sup\sprior\sto\sbacking\sit\sup\nas\spart\sof\sa\sdelete\soperation\son\sa\sdivider\scell\sin\san\sindex.
|
||||
D 2019-01-26T23:34:50.536
|
||||
C Update\sfuzzcheck\sso\sthat\swith\sthe\s--load-dbsql\soptions\sit\sscreens\sits\ninputs\sto\sensure\sthat\sthey\sare\svalid\sdbsqlfuzz\scases.\s\sAdd\snew\sdbsqlfuzz\nfinds\sto\sthe\stest/fuzzdata8.db\sdatabase.
|
||||
D 2019-01-27T01:11:40.746
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 9947eae873c07ae894d4c8633b76c0a0daca7b9fd54401096a77d1a6c7b74359
|
||||
@ -984,7 +984,7 @@ F test/fuzz3.test 9c813e6613b837cb7a277b0383cd66bfa07042b4cf0317157c35852f30043c
|
||||
F test/fuzz4.test c229bcdb45518a89e1d208a21343e061503460ac69fae1539320a89f572eb634
|
||||
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
|
||||
F test/fuzz_malloc.test f348276e732e814802e39f042b1f6da6362a610af73a528d8f76898fde6b22f2
|
||||
F test/fuzzcheck.c 4081b21460ce1f65b5904bdca27cf437476b414bf3f031fd4d6dfec58694b591
|
||||
F test/fuzzcheck.c 6bb28cc6ad247950e22bcc106bbeefff8c3c737f80c24573d8c18ef1cac6f2ac
|
||||
F test/fuzzdata1.db 7ee3227bad0e7ccdeb08a9e6822916777073c664
|
||||
F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f
|
||||
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
|
||||
@ -992,7 +992,7 @@ F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e4
|
||||
F test/fuzzdata5.db e35f64af17ec48926481cfaf3b3855e436bd40d1cfe2d59a9474cb4b748a52a5
|
||||
F test/fuzzdata6.db 92a80e4afc172c24f662a10a612d188fb272de4a9bd19e017927c95f737de6d7
|
||||
F test/fuzzdata7.db 3fc78e65dfe0be9df9e262075d5a335f18f627da47dfc691d1a7b822f34d4b99
|
||||
F test/fuzzdata8.db 8a96892bd2535578ff2ca27db823b7e149cfce6694c15ca80521fa758be605b1
|
||||
F test/fuzzdata8.db e2e2d82c8f41f123a5e8e5a6db953143743ade9f23908eac224f5a2b39d55832
|
||||
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
|
||||
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
|
||||
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
|
||||
@ -1804,7 +1804,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P d59567dda231e7ffec437d5e055676cf42d791196406cdc696cafa2583eb483b
|
||||
R a26bc7cfbb63ac2a47ad91e615545d2f
|
||||
P a3ea1a822d3a110f4f186f2fc8550f435c8c98635d058096b7be9d4df7066b8b
|
||||
R 03df092f631b381cdd6c4288d6623f64
|
||||
U drh
|
||||
Z c383150dc1908979b363a955c6f6b956
|
||||
Z b86c20bb8077d2eac80dc37ebee27c9e
|
||||
|
@ -1 +1 @@
|
||||
a3ea1a822d3a110f4f186f2fc8550f435c8c98635d058096b7be9d4df7066b8b
|
||||
004f7d9bbeee049c22a7e1c82c6cc0ea79a237967de3ff57686acea3060d5f45
|
@ -870,6 +870,17 @@ static int isDbSql(unsigned char *a, int n){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Implementation of the isdbsql(TEXT) SQL function.
|
||||
*/
|
||||
static void isDbSqlFunc(
|
||||
sqlite3_context *context,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
int n = sqlite3_value_bytes(argv[0]);
|
||||
unsigned char *a = (unsigned char*)sqlite3_value_blob(argv[0]);
|
||||
sqlite3_result_int(context, a!=0 && n>0 && isDbSql(a,n));
|
||||
}
|
||||
|
||||
/* Methods for the VHandle object
|
||||
*/
|
||||
@ -1169,23 +1180,28 @@ static void runSql(sqlite3 *db, const char *zSql, unsigned runFlags){
|
||||
** (2) Put all entries in order
|
||||
** (3) Vacuum
|
||||
*/
|
||||
static void rebuild_database(sqlite3 *db){
|
||||
static void rebuild_database(sqlite3 *db, int dbSqlOnly){
|
||||
int rc;
|
||||
rc = sqlite3_exec(db,
|
||||
char *zSql;
|
||||
zSql = sqlite3_mprintf(
|
||||
"BEGIN;\n"
|
||||
"CREATE TEMP TABLE dbx AS SELECT DISTINCT dbcontent FROM db;\n"
|
||||
"DELETE FROM db;\n"
|
||||
"INSERT INTO db(dbid, dbcontent) "
|
||||
" SELECT NULL, dbcontent FROM dbx ORDER BY 2;\n"
|
||||
"DROP TABLE dbx;\n"
|
||||
"CREATE TEMP TABLE sx AS SELECT DISTINCT sqltext FROM xsql;\n"
|
||||
"CREATE TEMP TABLE sx AS SELECT DISTINCT sqltext FROM xsql %s;\n"
|
||||
"DELETE FROM xsql;\n"
|
||||
"INSERT INTO xsql(sqlid,sqltext) "
|
||||
" SELECT NULL, sqltext FROM sx ORDER BY 2;\n"
|
||||
"DROP TABLE sx;\n"
|
||||
"COMMIT;\n"
|
||||
"PRAGMA page_size=1024;\n"
|
||||
"VACUUM;\n", 0, 0, 0);
|
||||
"VACUUM;\n",
|
||||
dbSqlOnly ? " WHERE isdbsql(sqltext)" : ""
|
||||
);
|
||||
rc = sqlite3_exec(db, zSql, 0, 0, 0);
|
||||
sqlite3_free(zSql);
|
||||
if( rc ) fatalError("cannot rebuild: %s", sqlite3_errmsg(db));
|
||||
}
|
||||
|
||||
@ -1279,6 +1295,7 @@ static void showHelp(void){
|
||||
" --limit-vdbe Panic if any test runs for more than 100,000 cycles\n"
|
||||
" --load-sql ARGS... Load SQL scripts fron files into SOURCE-DB\n"
|
||||
" --load-db ARGS... Load template databases from files into SOURCE_DB\n"
|
||||
" --load-dbsql ARGS.. Load dbsqlfuzz outputs into the xsql table\n"
|
||||
" -m TEXT Add a description to the database\n"
|
||||
" --native-vfs Use the native VFS for initially empty database files\n"
|
||||
" --native-malloc Turn off MEMSYS3/5 and Lookaside\n"
|
||||
@ -1305,6 +1322,7 @@ int main(int argc, char **argv){
|
||||
Blob *pSql; /* For looping over SQL scripts */
|
||||
Blob *pDb; /* For looping over template databases */
|
||||
int i; /* Loop index for the argv[] loop */
|
||||
int dbSqlOnly = 0; /* Only use scripts that are dbsqlfuzz */
|
||||
int onlySqlid = -1; /* --sqlid */
|
||||
int onlyDbid = -1; /* --dbid */
|
||||
int nativeFlag = 0; /* --native-vfs */
|
||||
@ -1361,7 +1379,7 @@ int main(int argc, char **argv){
|
||||
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
|
||||
zExpDb = argv[++i];
|
||||
}else
|
||||
if( strcmp(z,"export-sql")==0 ){
|
||||
if( strcmp(z,"export-sql")==0 || strcmp(z,"export-dbsql")==0 ){
|
||||
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
|
||||
zExpSql = argv[++i];
|
||||
}else
|
||||
@ -1396,6 +1414,13 @@ int main(int argc, char **argv){
|
||||
openFlags4Data = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
|
||||
break;
|
||||
}else
|
||||
if( strcmp(z,"load-dbsql")==0 ){
|
||||
zInsSql = "INSERT INTO xsql(sqltext)VALUES(CAST(readfile(?1) AS text))";
|
||||
iFirstInsArg = i+1;
|
||||
openFlags4Data = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
|
||||
dbSqlOnly = 1;
|
||||
break;
|
||||
}else
|
||||
if( strcmp(z,"m")==0 ){
|
||||
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
|
||||
zMsg = argv[++i];
|
||||
@ -1577,6 +1602,8 @@ int main(int argc, char **argv){
|
||||
if( zInsSql ){
|
||||
sqlite3_create_function(db, "readfile", 1, SQLITE_UTF8, 0,
|
||||
readfileFunc, 0, 0);
|
||||
sqlite3_create_function(db, "isdbsql", 1, SQLITE_UTF8, 0,
|
||||
isDbSqlFunc, 0, 0);
|
||||
rc = sqlite3_prepare_v2(db, zInsSql, -1, &pStmt, 0);
|
||||
if( rc ) fatalError("cannot prepare statement [%s]: %s",
|
||||
zInsSql, sqlite3_errmsg(db));
|
||||
@ -1592,7 +1619,7 @@ int main(int argc, char **argv){
|
||||
rc = sqlite3_exec(db, "COMMIT", 0, 0, 0);
|
||||
if( rc ) fatalError("cannot commit the transaction: %s",
|
||||
sqlite3_errmsg(db));
|
||||
rebuild_database(db);
|
||||
rebuild_database(db, dbSqlOnly);
|
||||
sqlite3_close(db);
|
||||
return 0;
|
||||
}
|
||||
@ -1679,7 +1706,7 @@ int main(int argc, char **argv){
|
||||
printf("%s: rebuilding... ", zDbName);
|
||||
fflush(stdout);
|
||||
}
|
||||
rebuild_database(db);
|
||||
rebuild_database(db, 0);
|
||||
if( !quietFlag ) printf("done\n");
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user