From dba61da1bfb7e4d74c723f369d1c017df9707a14 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 8 Sep 2022 08:03:57 -0400 Subject: Create a special "destroyed" type rather than using null When a QPDF is destroyed, changing indirect objects to direct nulls makes them effectively disappear silently when they sneak into other places. Instead, we should treat this as an error. Adding a destroyed object type makes this possible. --- include/qpdf/Constants.h | 1 + include/qpdf/QPDFObjectHandle.hh | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'include') diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h index 68214c62..84bd190b 100644 --- a/include/qpdf/Constants.h +++ b/include/qpdf/Constants.h @@ -123,6 +123,7 @@ enum qpdf_object_type_e { ot_inlineimage, /* Object types internal to qpdf */ ot_unresolved, + ot_destroyed, }; /* Write Parameters. See QPDFWriter.hh for details. */ diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 76e36eae..a4768f97 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -391,6 +391,11 @@ class QPDFObjectHandle QPDF_DLL inline bool isIndirect() const; + // This returns true for indirect objects from a QPDF that has + // been destroyed. + QPDF_DLL + bool isDestroyed(); + // True for everything except array, dictionary, stream, word, and // inline image. QPDF_DLL -- cgit v1.2.3-70-g09d2