2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

In QPDF::resolveObjectsInStream avoid creating xref table entries

Invalid entries are created when objects in the stream do not have
an existing xref entry.
This commit is contained in:
m-holger 2024-07-01 23:26:10 +01:00
parent 6d640c569a
commit a367e56afc

View File

@ -1952,8 +1952,9 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
m->last_object_description += "object ";
for (auto const& iter: offsets) {
QPDFObjGen og(iter.first, 0);
QPDFXRefEntry const& entry = m->xref_table[og];
if ((entry.getType() == 2) && (entry.getObjStreamNumber() == obj_stream_number)) {
auto entry = m->xref_table.find(og);
if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
entry->second.getObjStreamNumber() == obj_stream_number) {
int offset = iter.second;
input->seek(offset, SEEK_SET);
QPDFObjectHandle oh = readObjectInStream(input, iter.first);