Fuzz mode is now an argument not based on the exe name
Former-commit-id: 551a3cb1aa1c5799ec351dd2bef97adf0517b954
This commit is contained in:
parent
d9a244c34c
commit
61cc53d604
@ -800,6 +800,8 @@ void loadServerConfigFromString(char *config) {
|
|||||||
serverLog(LL_WARNING, "Warning version is overriden to: %s\n", KEYDB_SET_VERSION);
|
serverLog(LL_WARNING, "Warning version is overriden to: %s\n", KEYDB_SET_VERSION);
|
||||||
} else if (!strcasecmp(argv[0],"testmode") && argc == 2){
|
} else if (!strcasecmp(argv[0],"testmode") && argc == 2){
|
||||||
g_fTestMode = yesnotoi(argv[1]);
|
g_fTestMode = yesnotoi(argv[1]);
|
||||||
|
} else if (!strcasecmp(argv[0],"rdbfuzz-mode")) {
|
||||||
|
// NOP, handled in main
|
||||||
} else {
|
} else {
|
||||||
err = "Bad directive or wrong number of arguments"; goto loaderr;
|
err = "Bad directive or wrong number of arguments"; goto loaderr;
|
||||||
}
|
}
|
||||||
|
@ -4852,6 +4852,12 @@ void redisOutOfMemoryHandler(size_t allocation_size) {
|
|||||||
serverPanic("Redis aborting for OUT OF MEMORY");
|
serverPanic("Redis aborting for OUT OF MEMORY");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fuzzOutOfMemoryHandler(size_t allocation_size) {
|
||||||
|
serverLog(LL_WARNING,"Out Of Memory allocating %zu bytes!",
|
||||||
|
allocation_size);
|
||||||
|
exit(EXIT_FAILURE); // don't crash because it causes false positives
|
||||||
|
}
|
||||||
|
|
||||||
void redisSetProcTitle(const char *title) {
|
void redisSetProcTitle(const char *title) {
|
||||||
#ifdef USE_SETPROCTITLE
|
#ifdef USE_SETPROCTITLE
|
||||||
const char *server_mode = "";
|
const char *server_mode = "";
|
||||||
@ -5208,9 +5214,12 @@ int main(int argc, char **argv) {
|
|||||||
ACLLoadUsersAtStartup();
|
ACLLoadUsersAtStartup();
|
||||||
|
|
||||||
// special case of FUZZING load from stdin then quit
|
// special case of FUZZING load from stdin then quit
|
||||||
if (strstr(argv[0],"keydb-fuzz-rdb") != NULL)
|
if (argc > 1 && strstr(argv[1],"rdbfuzz-mode") != NULL)
|
||||||
{
|
{
|
||||||
serverAssert(GlobalLocksAcquired());
|
zmalloc_set_oom_handler(fuzzOutOfMemoryHandler);
|
||||||
|
#ifdef __AFL_HAVE_MANUAL_CONTROL
|
||||||
|
__AFL_INIT();
|
||||||
|
#endif
|
||||||
rio rdb;
|
rio rdb;
|
||||||
rdbSaveInfo rsi = RDB_SAVE_INFO_INIT;
|
rdbSaveInfo rsi = RDB_SAVE_INFO_INIT;
|
||||||
startLoading(stdin);
|
startLoading(stdin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user