From d6dd123afceecf7076d3aea597e0e366d4d0a0e4 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Thu, 2 Feb 2023 19:08:38 +0100 Subject: [PATCH] cmark: Update seed corpus (#9564) Generate seed corpus from our own test suite instead of relying on an external repo. Also remove redundant $SRC/cmark from paths. --- projects/cmark/Dockerfile | 2 +- projects/cmark/build.sh | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/projects/cmark/Dockerfile b/projects/cmark/Dockerfile index 99d811250..a03212977 100644 --- a/projects/cmark/Dockerfile +++ b/projects/cmark/Dockerfile @@ -15,7 +15,7 @@ ################################################################################ FROM gcr.io/oss-fuzz-base/base-builder -RUN apt-get update && apt-get install -y make cmake +RUN apt-get update && apt-get install -y make cmake python3 RUN git clone --depth 1 https://github.com/commonmark/cmark.git cmark WORKDIR cmark COPY build.sh *.dict *.options $SRC/ diff --git a/projects/cmark/build.sh b/projects/cmark/build.sh index 627fa6c43..b3e4ba696 100755 --- a/projects/cmark/build.sh +++ b/projects/cmark/build.sh @@ -17,22 +17,14 @@ make -j$(nproc) cmake_build -$CC $CFLAGS -Isrc -Ibuild/src -c $SRC/cmark/test/cmark-fuzz.c -o cmark_fuzzer.o +$CC $CFLAGS -Isrc -Ibuild/src -c test/cmark-fuzz.c -o cmark_fuzzer.o $CXX $CXXFLAGS $LIB_FUZZING_ENGINE cmark_fuzzer.o build/src/libcmark.a -o $OUT/cmark_fuzzer cp $SRC/*.options $OUT/ -cp $SRC/cmark/test/fuzzing_dictionary $OUT/cmark.dict +cp test/fuzzing_dictionary $OUT/cmark.dict mkdir -p corpus -cp $SRC/cmark/test/afl_test_cases/* corpus - -git clone --depth 1 https://github.com/michelf/mdtest.git mdtest -find mdtest/*.mdtest -type f -name '*.text' | while read in_file -do - # Genreate unique name for each input... - out_file=$(sha1sum "$in_file" | cut -c 1-32) - # ... and prepend a four-byte 'options' header - printf "\0\0\0\0" > "corpus/$out_file" - cat "$in_file" >> "corpus/$out_file" -done +python3 test/spec_tests.py --fuzz-corpus corpus --spec test/spec.txt +python3 test/spec_tests.py --fuzz-corpus corpus --spec test/regression.txt +python3 test/spec_tests.py --fuzz-corpus corpus --spec test/smart_punct.txt zip -j $OUT/cmark_fuzzer_seed_corpus.zip corpus/*