mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Guard against object id == std::numeric_limits<int> in QPDF::insertReconstructedXrefEntry
This commit is contained in:
parent
60c7d594b8
commit
e85b98b7e8
@ -114,6 +114,7 @@ set(CORPUS_OTHER
|
|||||||
65681.fuzz
|
65681.fuzz
|
||||||
65773.fuzz
|
65773.fuzz
|
||||||
65777.fuzz
|
65777.fuzz
|
||||||
|
68374.fuzz
|
||||||
68377.fuzz
|
68377.fuzz
|
||||||
)
|
)
|
||||||
|
|
||||||
|
BIN
fuzz/qpdf_extra/68374.fuzz
Normal file
BIN
fuzz/qpdf_extra/68374.fuzz
Normal file
Binary file not shown.
@ -21,7 +21,7 @@ my @fuzzers = (
|
|||||||
['pngpredictor' => 1],
|
['pngpredictor' => 1],
|
||||||
['runlength' => 6],
|
['runlength' => 6],
|
||||||
['tiffpredictor' => 2],
|
['tiffpredictor' => 2],
|
||||||
['qpdf' => 57], # increment when adding new files
|
['qpdf' => 58], # increment when adding new files
|
||||||
);
|
);
|
||||||
|
|
||||||
my $n_tests = 0;
|
my $n_tests = 0;
|
||||||
|
@ -1195,7 +1195,9 @@ QPDF::insertFreeXrefEntry(QPDFObjGen og)
|
|||||||
void
|
void
|
||||||
QPDF::insertReconstructedXrefEntry(int obj, qpdf_offset_t f1, int f2)
|
QPDF::insertReconstructedXrefEntry(int obj, qpdf_offset_t f1, int f2)
|
||||||
{
|
{
|
||||||
if (!(obj > 0 && 0 <= f2 && f2 < 65535)) {
|
// Various tables are indexed by object id, with potential size id + 1
|
||||||
|
constexpr static int max_id = std::numeric_limits<int>::max() - 1;
|
||||||
|
if (!(obj > 0 && obj <= max_id && 0 <= f2 && f2 < 65535)) {
|
||||||
QTC::TC("qpdf", "QPDF xref overwrite invalid objgen");
|
QTC::TC("qpdf", "QPDF xref overwrite invalid objgen");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user