1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-24 14:17:58 +03:00

Add the --max-stack option to dbfuzz2.

FossilOrigin-Name: c11ae4fed89484f0a0061002861b5d599bbda8e40a1f0c33fdbe8cb072134d5c
This commit is contained in:
drh
2019-01-20 00:03:59 +00:00
parent 27a037354c
commit 8ed07d1274
3 changed files with 27 additions and 8 deletions

View File

@@ -43,6 +43,8 @@
#include <stdarg.h>
#include <ctype.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "sqlite3.h"
/*
@@ -148,6 +150,23 @@ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
bVdbeDebug = 1;
continue;
}
if( strcmp(z,"max-stack")==0 ){
struct rlimit x,y;
if( i+1==argc ){
fprintf(stderr, "missing argument to %s\n", argv[i]);
exit(1);
}
memset(&x,0,sizeof(x));
getrlimit(RLIMIT_STACK, &x);
y.rlim_cur = atoi(argv[++i]);
y.rlim_max = x.rlim_cur;
setrlimit(RLIMIT_STACK, &y);
memset(&y,0,sizeof(y));
getrlimit(RLIMIT_STACK, &y);
printf("Stack size limit changed from %d to %d\n",
(int)x.rlim_cur, (int)y.rlim_cur);
continue;
}
}
argv[j++] = argv[i];
}