Commit e9df7871322569da1b35b4ac78ace93ab16974d7

Authored by m-holger
Committed by GitHub
2 parents ce2deaf1 c1cd3ec8

Merge pull request #1231 from m-holger/fuzz

In QPDF::processXRefIndex check number of objects in subsection is > 0
fuzz/CMakeLists.txt
... ... @@ -122,6 +122,7 @@ set(CORPUS_OTHER
122 122 69913.fuzz
123 123 69969.fuzz
124 124 69977.fuzz
  125 + 70055.fuzz
125 126 )
126 127  
127 128 set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)
... ...
fuzz/qpdf_extra/70055.fuzz 0 → 100644
No preview for this file type
fuzz/qtest/fuzz.test
... ... @@ -21,7 +21,7 @@ my @fuzzers = (
21 21 ['pngpredictor' => 1],
22 22 ['runlength' => 6],
23 23 ['tiffpredictor' => 2],
24   - ['qpdf' => 64], # increment when adding new files
  24 + ['qpdf' => 65], # increment when adding new files
25 25 );
26 26  
27 27 my $n_tests = 0;
... ...
libqpdf/QPDF.cc
... ... @@ -1129,6 +1129,11 @@ QPDF::processXRefIndex(
1129 1129 if (val.isInteger()) {
1130 1130 if (i % 2) {
1131 1131 auto count = val.getIntValue();
  1132 + if (count <= 0) {
  1133 + throw damaged(
  1134 + "Cross-reference stream section claims to contain " +
  1135 + std::to_string(count) + " entries");
  1136 + }
1132 1137 // We are guarding against the possibility of num_entries * entry_size
1133 1138 // overflowing. We are not checking that entries are in ascending order as
1134 1139 // required by the spec, which probably should generate a warning. We are also
... ...