From 0f98b940f851963e90ae062e18ba06034b0698e5 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Tue, 19 Apr 2022 19:37:09 +0200 Subject: [PATCH] Update fuzzers This changes the names of the two fuzzers so they align with current oss-fuzz usage (to provide continuity in test data and corpora) and adds a dictionary to the decoder fuzzer. It also removes some unnecessary configuration, as it clashed with oss-fuzz defaults --- .gitignore | 4 +-- configure.ac | 6 ++-- oss-fuzz/Makefile.am | 30 +++++++------------ .../{fuzz-decoder.cc => fuzzer_decoder.cc} | 0 oss-fuzz/fuzzer_decoder.dict | 6 ++++ .../{fuzz-encoder.cc => fuzzer_encoder.cc} | 0 ...{fuzz-encoder.dict => fuzzer_encoder.dict} | 0 7 files changed, 20 insertions(+), 26 deletions(-) rename oss-fuzz/{fuzz-decoder.cc => fuzzer_decoder.cc} (100%) create mode 100644 oss-fuzz/fuzzer_decoder.dict rename oss-fuzz/{fuzz-encoder.cc => fuzzer_encoder.cc} (100%) rename oss-fuzz/{fuzz-encoder.dict => fuzzer_encoder.dict} (100%) diff --git a/.gitignore b/.gitignore index 8e73e13c..36355d60 100644 --- a/.gitignore +++ b/.gitignore @@ -75,8 +75,8 @@ test/picture.diff test/picture.log .dirstamp microbench/benchmark_residual -oss-fuzz/fuzz-decoder -oss-fuzz/fuzz-encoder +oss-fuzz/fuzzer_decoder +oss-fuzz/fuzzer_encoder /*[Bb]uild*/ /out/ diff --git a/configure.ac b/configure.ac index 52b3ce04..7f3bfc20 100644 --- a/configure.ac +++ b/configure.ac @@ -382,15 +382,13 @@ if test "x$have_oss_fuzzers" = "xyes"; then else AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"]) # Disable fuzzer if the compiler is not Clang. - AC_MSG_WARN([*** Ozz-Fuzz is disabled because that requres the Clang compiler.]) - have_oss_fuzzers="no (compiler is GCC)" + AC_MSG_WARN([*** Ozz-Fuzz is disabled because that requires the Clang compiler.]) + have_oss_fuzzers="no (compiler is not Clang)" fi else AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"]) fi -AM_CONDITIONAL([USE_OSSFUZZ_FLAG], [test "x$LIB_FUZZING_ENGINE" = "x-fsanitize=fuzzer"]) -AM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"]) AC_SUBST([LIB_FUZZING_ENGINE]) dnl check for ogg library diff --git a/oss-fuzz/Makefile.am b/oss-fuzz/Makefile.am index 7c4e2f60..1cbfc55f 100644 --- a/oss-fuzz/Makefile.am +++ b/oss-fuzz/Makefile.am @@ -20,7 +20,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/oss-fuzz AM_CXXFLAGS = -std=c++11 EXTRA_DIST = \ - fuzz-encoder.dict \ + fuzzer_encoder.dict \ fuzzing/Readme.md \ fuzzing/datasource/datasource.hpp \ fuzzing/datasource/id.hpp \ @@ -28,31 +28,21 @@ EXTRA_DIST = \ fuzzing/memory.hpp \ fuzzing/types.hpp -if USE_OSSFUZZ_FLAG -FUZZ_FLAG = $(LIB_FUZZING_ENGINE) -FUZZ_LDADD = -lFuzzer -else -if USE_OSSFUZZ_STATIC -FUZZ_LDADD = $(LIB_FUZZING_ENGINE) -FUZZ_FLAG = -lFuzzer -endif -endif - noinst_PROGRAMS = if USE_OSSFUZZERS -noinst_PROGRAMS += fuzz-decoder fuzz-encoder +noinst_PROGRAMS += fuzzer_encoder fuzzer_decoder endif -fuzz_decoder_SOURCES = fuzz-decoder.cc -fuzz_decoder_CXXFLAGS = $(AM_CXXFLAGS) $(FUZZ_FLAG) -fuzz_decoder_LDFLAGS = $(AM_LDFLAGS) -static -fuzz_decoder_LDADD = $(flac_libs) $(FUZZ_LDADD) +fuzzer_encoder_SOURCES = fuzzer_encoder.cc +fuzzer_encoder_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE) +fuzzer_encoder_LDFLAGS = $(AM_LDFLAGS) +fuzzer_encoder_LDADD = $(flac_libs) -fuzz_encoder_SOURCES = fuzz-encoder.cc -fuzz_encoder_CXXFLAGS = $(AM_CXXFLAGS) $(FUZZ_FLAG) -fuzz_encoder_LDFLAGS = $(AM_LDFLAGS) -static -fuzz_encoder_LDADD = $(flac_libs) $(FUZZ_LDADD) +fuzzer_decoder_SOURCES = fuzzer_decoder.cc +fuzzer_decoder_CXXFLAGS = $(AM_CXXFLAGS) $(LIB_FUZZING_ENGINE) +fuzzer_decoder_LDFLAGS = $(AM_LDFLAGS) +fuzzer_decoder_LDADD = $(flac_libs) flac_libs = \ $(top_builddir)/src/libFLAC/libFLAC-static.la \ diff --git a/oss-fuzz/fuzz-decoder.cc b/oss-fuzz/fuzzer_decoder.cc similarity index 100% rename from oss-fuzz/fuzz-decoder.cc rename to oss-fuzz/fuzzer_decoder.cc diff --git a/oss-fuzz/fuzzer_decoder.dict b/oss-fuzz/fuzzer_decoder.dict new file mode 100644 index 00000000..0e79191b --- /dev/null +++ b/oss-fuzz/fuzzer_decoder.dict @@ -0,0 +1,6 @@ +flac_stream_marker="fLaC" +ogg_stream_marker="OggS" +flac_in_ogg_marker="\x7fFLAC" + +synccode_fixed_blocksize="\xFF\xF8" +synccode_variable_blocksize="\xFF\xF9" diff --git a/oss-fuzz/fuzz-encoder.cc b/oss-fuzz/fuzzer_encoder.cc similarity index 100% rename from oss-fuzz/fuzz-encoder.cc rename to oss-fuzz/fuzzer_encoder.cc diff --git a/oss-fuzz/fuzz-encoder.dict b/oss-fuzz/fuzzer_encoder.dict similarity index 100% rename from oss-fuzz/fuzz-encoder.dict rename to oss-fuzz/fuzzer_encoder.dict