Skip to content

Commit

Permalink
fuzz grep regex(3): fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
plusun committed Jul 25, 2018
1 parent cbf271e commit 0c239dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/fuzz/regex/grep/regcomp/Makefile
Expand Up @@ -6,12 +6,15 @@
PROG= fuzz_regcomp
SRCS= fuzz_regcomp.c
.PATH: ${NETBSDSRCDIR}/external/gpl2/grep/dist/lib
SRCS+= regex.c
.PATH: ${NETBSDSRCDIR}/external/gpl2/grep/dist/intl
# SRCS+= regex.c
SRCS+= hard-locale.c isdir.c \
regex.c stpcpy.c \
xstrtoumax.c
# .PATH: ${NETBSDSRCDIR}/external/gpl2/grep/dist/intl

CPPFLAGS+=-I${NETBSDSRCDIR}/external/gpl2/grep/dist/lib/posix -g -Wall -Werror -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I${NETBSDSRCDIR}/external/gpl2/grep/include
CPPFLAGS+=-g -I${NETBSDSRCDIR}/external/gpl2/grep/dist/lib/ -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I${NETBSDSRCDIR}/external/gpl2/grep/include -I${NETBSDSRCDIR}/external/gpl2/grep/dist/src/ -Dgettext=__MKFUZZER_gettext -Dregfree=__MKFUZZER_regfree -Dregcomp=__MKFUZZER_regcomp -Dregexec=__MKFUZZER_regexec -Dregerror=__MKFUZZER_regerror

fuzz: fuzz_regcomp
./fuzz_regcomp -only_ascii=1 -dict=./dict ./input > /dev/null
export UBSAN_OPTIONS=halt_on_error=1 && ./fuzz_regcomp -only_ascii=1 -dict=./dict ./input > /dev/null

.include <bsd.prog.mk>
4 changes: 4 additions & 0 deletions tests/fuzz/regex/grep/regcomp/fuzz_regcomp.c
Expand Up @@ -20,3 +20,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
free(d);
return 0;
}

const char *__MKFUZZER_gettext(const char *str) {
return str;
}

0 comments on commit 0c239dc

Please sign in to comment.