aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 01158ce2..fdd75359 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -711,8 +711,9 @@ QPDF::read_xref(qpdf_offset_t xref_offset)
QPDFObjGen last_og{-1, 0};
for (auto const& item: m->xref_table) {
auto id = item.first.getObj();
- if (id == last_og.getObj() && id > 0)
+ if (id == last_og.getObj() && id > 0) {
removeObject(last_og);
+ }
last_og = item.first;
}
}
@@ -2413,9 +2414,10 @@ QPDF::getCompressibleObjGens()
if (obj.getObjectID() > 0) {
QPDFObjGen og = obj.getObjGen();
const size_t id = toS(og.getObj() - 1);
- if (id >= max_obj)
+ if (id >= max_obj) {
throw std::logic_error(
"unexpected object id encountered in getCompressibleObjGens");
+ }
if (visited[id]) {
QTC::TC("qpdf", "QPDF loop detected traversing objects");
continue;