mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
In QPDF::filterCompressedObjects ignore objects not in QPDFWriter tables
Add fuzz case 68377.
This commit is contained in:
parent
972cbf103d
commit
60c7d594b8
@ -114,6 +114,7 @@ set(CORPUS_OTHER
|
||||
65681.fuzz
|
||||
65773.fuzz
|
||||
65777.fuzz
|
||||
68377.fuzz
|
||||
)
|
||||
|
||||
set(CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/qpdf_corpus)
|
||||
|
BIN
fuzz/qpdf_extra/68377.fuzz
Normal file
BIN
fuzz/qpdf_extra/68377.fuzz
Normal file
Binary file not shown.
@ -21,7 +21,7 @@ my @fuzzers = (
|
||||
['pngpredictor' => 1],
|
||||
['runlength' => 6],
|
||||
['tiffpredictor' => 2],
|
||||
['qpdf' => 56], # increment when adding new files
|
||||
['qpdf' => 57], # increment when adding new files
|
||||
);
|
||||
|
||||
my $n_tests = 0;
|
||||
|
@ -416,22 +416,26 @@ QPDF::filterCompressedObjects(QPDFWriter::ObjTable const& obj)
|
||||
ObjUser const& ou = i1.first;
|
||||
// Loop over objects.
|
||||
for (auto const& og: i1.second) {
|
||||
if (auto const& i2 = obj[og].object_stream; i2 <= 0) {
|
||||
t_obj_user_to_objects[ou].insert(og);
|
||||
} else {
|
||||
t_obj_user_to_objects[ou].insert(QPDFObjGen(i2, 0));
|
||||
if (obj.contains(og)) {
|
||||
if (auto const& i2 = obj[og].object_stream; i2 <= 0) {
|
||||
t_obj_user_to_objects[ou].insert(og);
|
||||
} else {
|
||||
t_obj_user_to_objects[ou].insert(QPDFObjGen(i2, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto const& i1: m->object_to_obj_users) {
|
||||
QPDFObjGen const& og = i1.first;
|
||||
// Loop over obj_users.
|
||||
for (auto const& ou: i1.second) {
|
||||
if (auto i2 = obj[og].object_stream; i2 <= 0) {
|
||||
t_object_to_obj_users[og].insert(ou);
|
||||
} else {
|
||||
t_object_to_obj_users[QPDFObjGen(i2, 0)].insert(ou);
|
||||
if (obj.contains(og)) {
|
||||
// Loop over obj_users.
|
||||
for (auto const& ou: i1.second) {
|
||||
if (auto i2 = obj[og].object_stream; i2 <= 0) {
|
||||
t_object_to_obj_users[og].insert(ou);
|
||||
} else {
|
||||
t_object_to_obj_users[QPDFObjGen(i2, 0)].insert(ou);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,12 @@ class ObjTable: public std::vector<T>
|
||||
return idx < std::vector<T>::size() || sparse_elements.count(idx);
|
||||
}
|
||||
|
||||
inline bool
|
||||
contains(QPDFObjGen og) const
|
||||
{
|
||||
return contains(static_cast<size_t>(og.getObj()));
|
||||
}
|
||||
|
||||
inline bool
|
||||
contains(QPDFObjectHandle oh) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user