Skip to content

Commit

Permalink
Change handling of qpdf fuzz corpus
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jberkenbilt committed Mar 18, 2022
1 parent ff481b5 commit c71e41e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 4 additions & 3 deletions README-maintainer
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 3 additions & 6 deletions fuzz/qtest/fuzz.test
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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;
Expand All @@ -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",
Expand Down

0 comments on commit c71e41e

Please sign in to comment.