aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFObjectHandle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r--libqpdf/QPDFObjectHandle.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 687ba439..cd3084cb 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -1089,6 +1089,16 @@ QPDFObjectHandle::parseInternal(PointerHolder<InputSource> input,
QPDFObjectHandle
QPDFObjectHandle::newIndirect(QPDF* qpdf, int objid, int generation)
{
+ if (objid == 0)
+ {
+ // Special case: QPDF uses objid 0 as a sentinel for direct
+ // objects, and the PDF specification doesn't allow for object
+ // 0. Treat indirect references to object 0 as null so that we
+ // never create an indirect object with objid 0.
+ QTC::TC("qpdf", "QPDFObjectHandle indirect with 0 objid");
+ return newNull();
+ }
+
return QPDFObjectHandle(qpdf, objid, generation);
}