mirror of https://github.com/qpdf/qpdf.git
Clean up fuzzer installation and add test files
* Create the seed corpus in the build directory * Don't assume all fuzzers share an options file
This commit is contained in:
parent
ed7f2a6c76
commit
2320714339
|
@ -22,8 +22,10 @@ $(BINS_fuzz): $(TARGETS_libqpdf) $(OBJ_DEFAULT_FUZZ)
|
||||||
# Files from the test suite that are good for seeding the fuzzer.
|
# Files from the test suite that are good for seeding the fuzzer.
|
||||||
# Update $n_test_files in qtest/fuzz.test if you change this list.
|
# Update $n_test_files in qtest/fuzz.test if you change this list.
|
||||||
SEED_CORPUS_FILES = \
|
SEED_CORPUS_FILES = \
|
||||||
|
stream-data.pdf \
|
||||||
|
lin5.pdf \
|
||||||
field-types.pdf \
|
field-types.pdf \
|
||||||
image-streams.pdf \
|
image-streams-small.pdf \
|
||||||
need-appearances.pdf \
|
need-appearances.pdf \
|
||||||
outlines-with-actions.pdf \
|
outlines-with-actions.pdf \
|
||||||
outlines-with-old-root-dests.pdf \
|
outlines-with-old-root-dests.pdf \
|
||||||
|
@ -53,7 +55,7 @@ SEED_CORPUS_FILES = \
|
||||||
# -----
|
# -----
|
||||||
|
|
||||||
CORPUS_FROM_TEST := $(foreach F,$(SEED_CORPUS_FILES),qpdf/qtest/qpdf/$F)
|
CORPUS_FROM_TEST := $(foreach F,$(SEED_CORPUS_FILES),qpdf/qtest/qpdf/$F)
|
||||||
CORPUS_DIR := fuzz/qpdf_fuzzer_seed_corpus
|
CORPUS_DIR := fuzz/$(OUTPUT_DIR)/qpdf_fuzzer_seed_corpus
|
||||||
|
|
||||||
.PHONY: fuzz_corpus
|
.PHONY: fuzz_corpus
|
||||||
fuzz_corpus:: fuzz/$(OUTPUT_DIR)/fuzz_corpus.stamp
|
fuzz_corpus:: fuzz/$(OUTPUT_DIR)/fuzz_corpus.stamp
|
||||||
|
@ -68,7 +70,7 @@ $(foreach F,$(CORPUS_FROM_TEST),$(eval \
|
||||||
|
|
||||||
fuzz/$(OUTPUT_DIR)/fuzz_corpus.stamp: fuzz/original-corpus.tar.gz $(CORPUS_FROM_TEST)
|
fuzz/$(OUTPUT_DIR)/fuzz_corpus.stamp: fuzz/original-corpus.tar.gz $(CORPUS_FROM_TEST)
|
||||||
mkdir -p $(CORPUS_DIR)
|
mkdir -p $(CORPUS_DIR)
|
||||||
(cd $(CORPUS_DIR); tar xzf ../original-corpus.tar.gz)
|
(cd $(CORPUS_DIR); tar xzf ../../original-corpus.tar.gz)
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
$(foreach B,$(FUZZERS),$(eval \
|
$(foreach B,$(FUZZERS),$(eval \
|
||||||
|
@ -122,9 +124,11 @@ install_fuzz: $(STATIC_BINS_fuzz)
|
||||||
mkdir -p $(OUT)
|
mkdir -p $(OUT)
|
||||||
cp fuzz/pdf.dict $(STATIC_BINS_fuzz) $(OUT)/
|
cp fuzz/pdf.dict $(STATIC_BINS_fuzz) $(OUT)/
|
||||||
for B in $(FUZZERS); do \
|
for B in $(FUZZERS); do \
|
||||||
cp fuzz/options $(OUT)/$${B}.options; \
|
if test -f fuzz/$${B}.options; then \
|
||||||
if test -d fuzz/$${B}_seed_corpus; then \
|
cp fuzz/$${B}.options $(OUT)/$${B}.options; \
|
||||||
(cd fuzz/$${B}_seed_corpus; zip -q -r $(OUT)/$${B}_seed_corpus.zip .); \
|
fi; \
|
||||||
|
if test -d fuzz/$(OUTPUT_DIR)/$${B}_seed_corpus; then \
|
||||||
|
(cd fuzz/$(OUTPUT_DIR)/$${B}_seed_corpus; zip -q -r $(OUT)/$${B}_seed_corpus.zip .); \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ require TestDriver;
|
||||||
|
|
||||||
my $td = new TestDriver('fuzz');
|
my $td = new TestDriver('fuzz');
|
||||||
|
|
||||||
my @files = glob("../qpdf_fuzzer_seed_corpus/*");
|
my @files = glob("../build/qpdf_fuzzer_seed_corpus/*");
|
||||||
my $n_test_files = 27;
|
my $n_test_files = 29;
|
||||||
my $n_orig_files = 2559;
|
my $n_orig_files = 2559;
|
||||||
my $n_files = $n_test_files + $n_orig_files;
|
my $n_files = $n_test_files + $n_orig_files;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue