2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-09 14:50:58 +00:00

Suppress excessive warnings while fuzzing

Add extra fuzz test case and amend memory limit for Pl_DCT.
This commit is contained in:
m-holger 2024-06-30 13:01:50 +01:00
parent 9081ac69cd
commit 42c511198b
6 changed files with 13 additions and 5 deletions

View File

@ -121,6 +121,7 @@ set(CORPUS_OTHER
69857.fuzz
69913.fuzz
69969.fuzz
69977.fuzz
)
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)

BIN
fuzz/qpdf_extra/69977.fuzz Normal file

Binary file not shown.

View File

@ -173,11 +173,11 @@ FuzzHelper::doChecks()
{
// Get as much coverage as possible in parts of the library that
// might benefit from fuzzing.
std::cout << "starting testWrite\n";
std::cerr << "\ninfo: starting testWrite\n";
testWrite();
std::cout << "\nstarting testPages\n\n";
std::cerr << "\ninfo: starting testPages\n";
testPages();
std::cout << "\nstarting testOutlines\n\n";
std::cerr << "\ninfo: starting testOutlines\n";
testOutlines();
}

View File

@ -21,7 +21,7 @@ my @fuzzers = (
['pngpredictor' => 1],
['runlength' => 6],
['tiffpredictor' => 2],
['qpdf' => 63], # increment when adding new files
['qpdf' => 64], # increment when adding new files
);
my $n_tests = 0;

View File

@ -320,7 +320,7 @@ Pl_DCT::decompress(void* cinfo_p, Buffer* b)
cinfo->mem->max_memory_to_use = 1'000'000'000;
// For some corrupt files the memory used internally by libjpeg stays within the above limits
// even though the size written to the next pipeline is significantly larger.
m->corrupt_data_limit = 100'000'000;
m->corrupt_data_limit = 10'000'000;
#endif
jpeg_buffer_src(cinfo, b);

View File

@ -494,6 +494,13 @@ QPDF::warn(QPDFExc const& e)
{
m->warnings.push_back(e);
if (!m->suppress_warnings) {
#ifdef QPDF_OSS_FUZZ
if (m->warnings.size() > 20) {
*m->log->getWarn() << "WARNING: too many warnings - additional warnings surpressed\n";
m->suppress_warnings = true;
return;
}
#endif
*m->log->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
}
}