From c71e41e9d9e24fd433e92732cc4253d3f9d67b80 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 5 Mar 2022 08:21:30 -0500 Subject: [PATCH] Change handling of qpdf fuzz corpus Files are copied into the build area rather than left in the source tree, and the test suite looks for them there. Also remove special case around counting files in the qpdf corpus. --- README-maintainer | 7 ++++--- fuzz/qtest/fuzz.test | 9 +++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README-maintainer b/README-maintainer index a601b94f..95f98d56 100644 --- a/README-maintainer +++ b/README-maintainer @@ -66,9 +66,10 @@ GOOGLE OSS-FUZZ * qpdf project: https://github.com/google/oss-fuzz/tree/master/projects/qpdf * Adding new test cases: download the file from oss-fuzz and drop it - in fuzz/qpdf_extra/issue-number.fuzz. If not ready to include, it - can be stored anywhere, and the absolute path can be passed to the - reproduction code as described below. + in fuzz/qpdf_extra/issue-number.fuzz. When ready to include it, add + to fuzz/CMakeLists.txt. Until ready to use, the file can be stored + anywhere, and the absolute path can be passed to the reproduction + code as described below. * To test locally, see https://github.com/google/oss-fuzz/tree/master/docs/, especially new_project_guide.md. Summary: diff --git a/fuzz/qtest/fuzz.test b/fuzz/qtest/fuzz.test index ad3e448f..d234ce79 100644 --- a/fuzz/qtest/fuzz.test +++ b/fuzz/qtest/fuzz.test @@ -9,10 +9,7 @@ require TestDriver; my $td = new TestDriver('fuzz'); -my $qpdf_n_test_files = 31; -my @extra = glob("../qpdf_extra/*.fuzz"); -my $qpdf_n_extra_files = scalar(@extra); -my $qpdf_n_files = ($qpdf_n_test_files + $qpdf_n_extra_files); +my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS"; my @fuzzers = ( ['ascii85' => 1], @@ -23,7 +20,7 @@ my @fuzzers = ( ['pngpredictor' => 1], ['runlength' => 6], ['tiffpredictor' => 1], - ['qpdf' => $qpdf_n_files], + ['qpdf' => 52], # increment when adding new files ); my $n_tests = 0; @@ -40,7 +37,7 @@ foreach my $d (@fuzzers) my $dir = "../${k}_fuzzer_seed_corpus"; if (! -d $dir) { - $dir = "../build/${k}_fuzzer_seed_corpus"; + $dir = $qpdf_corpus; } my @files = glob("$dir/*"); $td->runtest("file count for $dir",