In dbfuzz2, avoid using a malloc in the LLVMFuzzerInitialize() initializer

routine, so that no memory leaks are reported.  Also, show the version of
SQLite being used when the -v option is on.

FossilOrigin-Name: 824f93246988ffa213bbd41a7de08886999b1a8ae00fdf6b9767acb6e3ec6a1f
This commit is contained in:
drh 2019-01-13 20:23:34 +00:00
parent f202c6cdcf
commit b10a50e7f8
3 changed files with 12 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Relax\sthe\sminimum\ssize\sdatabase\sfile\sconstraint\son\sthe\sdbtotxt\sutility\sprogram. C In\sdbfuzz2,\savoid\susing\sa\smalloc\sin\sthe\sLLVMFuzzerInitialize()\sinitializer\nroutine,\sso\sthat\sno\smemory\sleaks\sare\sreported.\s\sAlso,\sshow\sthe\sversion\sof\nSQLite\sbeing\sused\swhen\sthe\s-v\soption\sis\son.
D 2019-01-13T20:17:52.605 D 2019-01-13T20:23:34.262
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 45a3fef4d325ac0220c2172aeec4e4321da351f073f3b8e8ddea655f49ef6f2b F Makefile.in 45a3fef4d325ac0220c2172aeec4e4321da351f073f3b8e8ddea655f49ef6f2b
@ -781,7 +781,7 @@ F test/date2.test 74c234bece1b016e94dd4ef9c8cc7a199a8806c0e2291cab7ba64bace6350b
F test/dbfuzz.c 73047c920d6210e5912c87cdffd9a1c281d4252e F test/dbfuzz.c 73047c920d6210e5912c87cdffd9a1c281d4252e
F test/dbfuzz001.test 5659cbbc01e38678c119c8a58071cac59d0d6c71837a385f3d1838012f12e1e1 F test/dbfuzz001.test 5659cbbc01e38678c119c8a58071cac59d0d6c71837a385f3d1838012f12e1e1
F test/dbfuzz2-seed1.db e6225c6f3d7b63f9c5b6867146a5f329d997ab105bee64644dc2b3a2f2aebaee F test/dbfuzz2-seed1.db e6225c6f3d7b63f9c5b6867146a5f329d997ab105bee64644dc2b3a2f2aebaee
F test/dbfuzz2.c b31e0383472d88d25c0f2143e6f86ccef699703d3cee0d5865cef062e42ccf4b F test/dbfuzz2.c cf600006051826b4c923471a0f502813d5e10f27bc627fac5a7d26c831765364
F test/dbpage.test 650234ba683b9d82b899c6c51439819787e7609f17a0cc40e0080a7b6443bc38 F test/dbpage.test 650234ba683b9d82b899c6c51439819787e7609f17a0cc40e0080a7b6443bc38
F test/dbstatus.test cd83aa623b8aab477269bc94cf8aa90c1e195a144561dd04a1620770aaa8524e F test/dbstatus.test cd83aa623b8aab477269bc94cf8aa90c1e195a144561dd04a1620770aaa8524e
F test/dbstatus2.test f5fe0afed3fa45e57cfa70d1147606c20d2ba23feac78e9a172f2fe8ab5b78ef F test/dbstatus2.test f5fe0afed3fa45e57cfa70d1147606c20d2ba23feac78e9a172f2fe8ab5b78ef
@ -1798,7 +1798,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 35f04235c477501390acea126d07a730d81d03cdf7abcd82d861e397b3f75b0f P 97e723d746eeb2159f5bf1701532271ac6a4620879c82d496f4499c178b64479
R a7199e598cf59242d3490ce34402fc8b R 018cc9497956b71ce50ebe4039e4c70b
U drh U drh
Z e0556037eed9424da9e46a11c6d6dc83 Z e7be8d96bead9a75143219194f67e213

View File

@ -1 +1 @@
97e723d746eeb2159f5bf1701532271ac6a4620879c82d496f4499c178b64479 824f93246988ffa213bbd41a7de08886999b1a8ae00fdf6b9767acb6e3ec6a1f

View File

@ -134,11 +134,7 @@ static int numberOfVChar(const char *z){
int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
int i, j, n; int i, j, n;
int argc = *pArgc; int argc = *pArgc;
char **newArgv;
char **argv = *pArgv; char **argv = *pArgv;
newArgv = malloc( sizeof(char*)*(argc+1) );
if( newArgv==0 ) return 0;
newArgv[0] = argv[0];
for(i=j=1; i<argc; i++){ for(i=j=1; i<argc; i++){
char *z = argv[i]; char *z = argv[i];
if( z[0]=='-' ){ if( z[0]=='-' ){
@ -153,10 +149,9 @@ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
continue; continue;
} }
} }
newArgv[j++] = argv[i]; argv[j++] = argv[i];
} }
newArgv[j] = 0; argv[j] = 0;
*pArgv = newArgv;
*pArgc = j; *pArgc = j;
return 0; return 0;
} }
@ -202,6 +197,9 @@ int main(int argc, char **argv){
free(pIn); free(pIn);
} }
} }
if( eVerbosity>0 ){
printf("SQLite %s\n", sqlite3_sourceid());
}
return 0; return 0;
} }
#endif /*STANDALONE*/ #endif /*STANDALONE*/