2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

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.
This commit is contained in:
Jay Berkenbilt 2022-03-05 08:21:30 -05:00 committed by Jay Berkenbilt
parent ff481b590b
commit c71e41e9d9
2 changed files with 7 additions and 9 deletions

View File

@ -66,9 +66,10 @@ GOOGLE OSS-FUZZ
* qpdf project: https://github.com/google/oss-fuzz/tree/master/projects/qpdf * 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 * 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 in fuzz/qpdf_extra/issue-number.fuzz. When ready to include it, add
can be stored anywhere, and the absolute path can be passed to the to fuzz/CMakeLists.txt. Until ready to use, the file can be stored
reproduction code as described below. 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/, * To test locally, see https://github.com/google/oss-fuzz/tree/master/docs/,
especially new_project_guide.md. Summary: especially new_project_guide.md. Summary:

View File

@ -9,10 +9,7 @@ require TestDriver;
my $td = new TestDriver('fuzz'); my $td = new TestDriver('fuzz');
my $qpdf_n_test_files = 31; my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS";
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 @fuzzers = ( my @fuzzers = (
['ascii85' => 1], ['ascii85' => 1],
@ -23,7 +20,7 @@ my @fuzzers = (
['pngpredictor' => 1], ['pngpredictor' => 1],
['runlength' => 6], ['runlength' => 6],
['tiffpredictor' => 1], ['tiffpredictor' => 1],
['qpdf' => $qpdf_n_files], ['qpdf' => 52], # increment when adding new files
); );
my $n_tests = 0; my $n_tests = 0;
@ -40,7 +37,7 @@ foreach my $d (@fuzzers)
my $dir = "../${k}_fuzzer_seed_corpus"; my $dir = "../${k}_fuzzer_seed_corpus";
if (! -d $dir) if (! -d $dir)
{ {
$dir = "../build/${k}_fuzzer_seed_corpus"; $dir = $qpdf_corpus;
} }
my @files = glob("$dir/*"); my @files = glob("$dir/*");
$td->runtest("file count for $dir", $td->runtest("file count for $dir",