Commit e9df7871322569da1b35b4ac78ace93ab16974d7
Committed by
GitHub
Merge pull request #1231 from m-holger/fuzz
In QPDF::processXRefIndex check number of objects in subsection is > 0
Showing
4 changed files
with
7 additions
and
1 deletions
fuzz/CMakeLists.txt
fuzz/qpdf_extra/70055.fuzz
0 → 100644
No preview for this file type
fuzz/qtest/fuzz.test
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 | ... | ... |