Commit e85b98b7e8b8b330614fc31825c411260fc2eaef
1 parent
60c7d594
Guard against object id == std::numeric_limits<int> in QPDF::insertReconstructedXrefEntry
Showing
4 changed files
with
5 additions
and
2 deletions
fuzz/CMakeLists.txt
fuzz/qpdf_extra/68374.fuzz
0 → 100644
No preview for this file type
fuzz/qtest/fuzz.test
libqpdf/QPDF.cc
| ... | ... | @@ -1195,7 +1195,9 @@ QPDF::insertFreeXrefEntry(QPDFObjGen og) |
| 1195 | 1195 | void |
| 1196 | 1196 | QPDF::insertReconstructedXrefEntry(int obj, qpdf_offset_t f1, int f2) |
| 1197 | 1197 | { |
| 1198 | - if (!(obj > 0 && 0 <= f2 && f2 < 65535)) { | |
| 1198 | + // Various tables are indexed by object id, with potential size id + 1 | |
| 1199 | + constexpr static int max_id = std::numeric_limits<int>::max() - 1; | |
| 1200 | + if (!(obj > 0 && obj <= max_id && 0 <= f2 && f2 < 65535)) { | |
| 1199 | 1201 | QTC::TC("qpdf", "QPDF xref overwrite invalid objgen"); |
| 1200 | 1202 | return; |
| 1201 | 1203 | } | ... | ... |