From: drh Date: Fri, 11 Jan 2019 14:38:47 +0000 (+0000) Subject: Add the --vdbe-debug command-line option to dbfuzz2. X-Git-Tag: version-3.27.0~179 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1972c8cf073b7ddb1e5872628f7c2d078f794740;p=thirdparty%2Fsqlite.git Add the --vdbe-debug command-line option to dbfuzz2. FossilOrigin-Name: 599b4df43c64ce295517c804b6bb4c3ab77d77e0ba585dc0657274f55489a3b1 --- diff --git a/manifest b/manifest index 3a592fd6d0..f4b38ef12a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"dbfuzz2"\starget\sto\smain.mk.\s\sRemove\san\sunused\slocal\svariable\nfrom\sdbfuzz2.c. -D 2019-01-11T14:22:33.979 +C Add\sthe\s--vdbe-debug\scommand-line\soption\sto\sdbfuzz2. +D 2019-01-11T14:38:47.236 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 45a3fef4d325ac0220c2172aeec4e4321da351f073f3b8e8ddea655f49ef6f2b @@ -780,7 +780,7 @@ F test/date2.test 74c234bece1b016e94dd4ef9c8cc7a199a8806c0e2291cab7ba64bace6350b F test/dbfuzz.c 73047c920d6210e5912c87cdffd9a1c281d4252e F test/dbfuzz001.test 5659cbbc01e38678c119c8a58071cac59d0d6c71837a385f3d1838012f12e1e1 F test/dbfuzz2-seed1.db e6225c6f3d7b63f9c5b6867146a5f329d997ab105bee64644dc2b3a2f2aebaee -F test/dbfuzz2.c a1221da27dd1a08900f25471fea65dc43abba2c110c03a815760744ccde9d8d0 +F test/dbfuzz2.c b31e0383472d88d25c0f2143e6f86ccef699703d3cee0d5865cef062e42ccf4b F test/dbpage.test 650234ba683b9d82b899c6c51439819787e7609f17a0cc40e0080a7b6443bc38 F test/dbstatus.test cd83aa623b8aab477269bc94cf8aa90c1e195a144561dd04a1620770aaa8524e F test/dbstatus2.test f5fe0afed3fa45e57cfa70d1147606c20d2ba23feac78e9a172f2fe8ab5b78ef @@ -1797,7 +1797,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 5547f39de993c708f72301ef25df190a2f007e0c4253799bdd9e86bb1ae41777 -R ab42d90b18d096a2e03d11a8df7c0b73 +P 05c7609cfd02f49114876267d7090f4e0ea2467f3aa7c65019c5986ec8f60a87 +R 59f8d809003217ffe40e8229e82747b7 U drh -Z 7e967bef866c326fb525219eb419a5f5 +Z 065fa37efdf7cf83e88a09444acc4d6c diff --git a/manifest.uuid b/manifest.uuid index 0bd9ede018..879d48c37b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -05c7609cfd02f49114876267d7090f4e0ea2467f3aa7c65019c5986ec8f60a87 \ No newline at end of file +599b4df43c64ce295517c804b6bb4c3ab77d77e0ba585dc0657274f55489a3b1 \ No newline at end of file diff --git a/test/dbfuzz2.c b/test/dbfuzz2.c index 9ce1d2249a..0bf0f0888b 100644 --- a/test/dbfuzz2.c +++ b/test/dbfuzz2.c @@ -64,6 +64,9 @@ static const char *azSql[] = { /* Output verbosity level. 0 means complete silence */ int eVerbosity = 0; +/* True to activate PRAGMA vdbe_debug=on */ +static int bVdbeDebug = 0; + /* libFuzzer invokes this routine with fuzzed database files (in aData). ** This routine run SQLite against the malformed database to see if it ** can provoke a failure or malfunction. @@ -87,6 +90,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *aData, size_t nByte){ sqlite3_deserialize(db, "main", a, nByte, nByte, SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE); + if( bVdbeDebug ){ + sqlite3_exec(db, "PRAGMA vdbe_debug=ON", 0, 0, 0); + } for(i=0; i=1 ){ printf("%s\n", azSql[i]); @@ -109,11 +115,24 @@ int LLVMFuzzerTestOneInput(const uint8_t *aData, size_t nByte){ return 0; } +/* +** Return the number of "v" characters in a string. Return 0 if there +** are any characters in the string other than "v". +*/ +static int numberOfVChar(const char *z){ + int N = 0; + while( z[0] && z[0]=='v' ){ + z++; + N++; + } + return z[0]==0 ? N : 0; +} + /* libFuzzer invokes this routine once when the executable starts, to ** process the command-line arguments. */ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){ - int i, j; + int i, j, n; int argc = *pArgc; char **newArgv; char **argv = *pArgv; @@ -125,8 +144,12 @@ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){ if( z[0]=='-' ){ z++; if( z[0]=='-' ) z++; - if( strcmp(z,"v")==0 ){ - eVerbosity++; + if( z[0]=='v' && (n = numberOfVChar(z))>0 ){ + eVerbosity += n; + continue; + } + if( strcmp(z,"vdbe-debug")==0 ){ + bVdbeDebug = 1; continue; } }