mirror of
https://github.com/benhoyt/inih.git
synced 2025-02-05 07:08:23 +08:00
Revert "[oss-fuzz] fuzzing support (#153)"
This reverts commit 9114067a92fa58694bd816bb52f805476908a8a2.
This commit is contained in:
parent
e28a71f244
commit
53a7c05339
@ -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/
|
|
||||||
```
|
|
@ -41,8 +41,6 @@ void parse(const char* fname) {
|
|||||||
u++;
|
u++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
@ -52,31 +50,3 @@ int main(int argc, char **argv)
|
|||||||
parse(argv[1]);
|
parse(argv[1]);
|
||||||
return 0;
|
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
|
|
||||||
|
@ -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
|
|
Loading…
x
Reference in New Issue
Block a user