aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-08-22 23:53:20 +0200
committerJay Berkenbilt <ejb@ql.org>2019-08-22 23:55:16 +0200
commit4b2e72c4cd7dc9bc17ad78ca983ff884c1e1ee69 (patch)
treeaf9dc8355ef29d6fd96a771ad9bb9de7f6ce70b6 /libqpdf
parent3f3dbe22eaae56df48af304c35a1c0b5dd976135 (diff)
downloadqpdf-4b2e72c4cd7dc9bc17ad78ca983ff884c1e1ee69.tar.zst
Test for direct, rather than resolved nulls in parser
Just because we know an indirect reference is null, doesn't mean we shouldn't keep it indirect.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFObjectHandle.cc5
-rw-r--r--libqpdf/SparseOHArray.cc4
2 files changed, 5 insertions, 4 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 6240395d..c58675a4 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -263,9 +263,10 @@ QPDFObjectHandle::isBool()
}
bool
-QPDFObjectHandle::isResolvedNull() const
+QPDFObjectHandle::isDirectNull() const
{
- return QPDFObjectTypeAccessor<QPDF_Null>::check(m->obj.getPointer());
+ return (this->m->initialized && (this->m->objid == 0) &&
+ QPDFObjectTypeAccessor<QPDF_Null>::check(m->obj.getPointer()));
}
bool
diff --git a/libqpdf/SparseOHArray.cc b/libqpdf/SparseOHArray.cc
index 76c7c224..05b44ee0 100644
--- a/libqpdf/SparseOHArray.cc
+++ b/libqpdf/SparseOHArray.cc
@@ -15,7 +15,7 @@ SparseOHArray::size() const
void
SparseOHArray::append(QPDFObjectHandle oh)
{
- if (! oh.isResolvedNull())
+ if (! oh.isDirectNull())
{
this->elements[this->n_elements] = oh;
}
@@ -73,7 +73,7 @@ SparseOHArray::setAt(size_t idx, QPDFObjectHandle oh)
{
throw std::logic_error("bounds error setting item in SparseOHArray");
}
- if (oh.isResolvedNull())
+ if (oh.isDirectNull())
{
this->elements.erase(idx);
}