mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Update dbfuzz2 to set a maximum database size of 100MiB by default, but
with the new --max-db-size N option to change that limit. FossilOrigin-Name: 21d6bb78ef2979d011b917d2d6519d7cd0009fcad83ed23ab2e9a5e02d8e51ab
This commit is contained in:
@ -69,6 +69,9 @@ int eVerbosity = 0;
|
||||
/* True to activate PRAGMA vdbe_debug=on */
|
||||
static int bVdbeDebug = 0;
|
||||
|
||||
/* Maximum size of the in-memory database file */
|
||||
static sqlite3_int64 szMax = 104857600;
|
||||
|
||||
/* 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.
|
||||
@ -78,6 +81,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *aData, size_t nByte){
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
int i;
|
||||
sqlite3_int64 x;
|
||||
|
||||
if( eVerbosity>=1 ){
|
||||
printf("************** nByte=%d ***************\n", (int)nByte);
|
||||
@ -92,6 +96,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *aData, size_t nByte){
|
||||
sqlite3_deserialize(db, "main", a, nByte, nByte,
|
||||
SQLITE_DESERIALIZE_RESIZEABLE |
|
||||
SQLITE_DESERIALIZE_FREEONCLOSE);
|
||||
x = szMax;
|
||||
sqlite3_file_control(db, "main", SQLITE_FCNTL_SIZE_LIMIT, &x);
|
||||
if( bVdbeDebug ){
|
||||
sqlite3_exec(db, "PRAGMA vdbe_debug=ON", 0, 0, 0);
|
||||
}
|
||||
@ -150,6 +156,14 @@ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
|
||||
bVdbeDebug = 1;
|
||||
continue;
|
||||
}
|
||||
if( strcmp(z,"max-db-size")==0 ){
|
||||
if( i+1==argc ){
|
||||
fprintf(stderr, "missing argument to %s\n", argv[i]);
|
||||
exit(1);
|
||||
}
|
||||
szMax = strtol(argv[++i], 0, 0);
|
||||
continue;
|
||||
}
|
||||
if( strcmp(z,"max-stack")==0
|
||||
|| strcmp(z,"max-data")==0
|
||||
|| strcmp(z,"max-as")==0
|
||||
|
Reference in New Issue
Block a user