diff --git a/fuzzing/OSS-FUZZ.MD b/fuzzing/OSS-FUZZ.MD deleted file mode 100644 index 0824d83..0000000 --- a/fuzzing/OSS-FUZZ.MD +++ /dev/null @@ -1,31 +0,0 @@ -### oss-fuzz local build with ASAN - -``` -export CC=clang -export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link" -export LIB_FUZZING_ENGINE="-fsanitize=fuzzer" -``` - -### oss-fuzz local build with MSAN - -``` -export CC=clang -export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize-memory-track-origins -fsanitize=fuzzer-no-link" -export LIB_FUZZING_ENGINE="-fsanitize=fuzzer" -``` - - -### oss-fuzz local build with UBSAN -``` -export CC=clang -export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=array-bounds,bool,builtin,enum,float-divide-by-zero,function,integer-divide-by-zero,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,unsigned-integer-overflow,unreachable,vla-bound,vptr -fno-sanitize-recover=array-bounds,bool,builtin,enum,float-divide-by-zero,function,integer-divide-by-zero,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize=fuzzer-no-link" -export LIB_FUZZING_ENGINE="-fsanitize=fuzzer" -``` - -### run fuzzer -``` -bash oss-fuzz.sh -mkdir seed/ -cp ../tests/*.ini seed/ -./inihfuzz seed/ -``` diff --git a/fuzzing/inihfuzz.c b/fuzzing/inihfuzz.c index a181152..d07e338 100644 --- a/fuzzing/inihfuzz.c +++ b/fuzzing/inihfuzz.c @@ -41,8 +41,6 @@ void parse(const char* fname) { u++; } -#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - int main(int argc, char **argv) { if (argc < 2) { @@ -52,31 +50,3 @@ int main(int argc, char **argv) parse(argv[1]); return 0; } - -#else - -#define kMinInputLength 20 -#define kMaxInputLength 1024 - -extern int LLVMFuzzerTestOneInput(const char *Data, size_t Size) { - - if (Size < kMinInputLength || Size > kMaxInputLength) { - return 0; - } - - int ret; - *Prev_section = '\0'; - int u = 100; - - char *data = malloc(Size + 1); - memcpy(data, Data, Size); - data[Size] = '\0'; - - ret = ini_parse(data, dumper, &u); - - free(data); - - return ret; -} - -#endif diff --git a/fuzzing/oss-fuzz.sh b/fuzzing/oss-fuzz.sh deleted file mode 100755 index e92ff37..0000000 --- a/fuzzing/oss-fuzz.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -$CC $CFLAGS -c ../ini.c -$CC $CFLAGS -c inihfuzz.c -$CXX $CFLAGS $LIB_FUZZING_ENGINE inihfuzz.o ini.o -o inihfuzz