diff options
author | Jay Berkenbilt <ejb@ql.org> | 2017-07-26 20:38:49 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2017-07-28 00:20:31 +0200 |
commit | 40f00122b811ca5c8788856f5baf4e5e088926eb (patch) | |
tree | 3a8247e134b7624932cd5d1b29110eda39664d5a /include | |
parent | dd8dad74f47b6068281dd605a04bc2d0b6283423 (diff) | |
download | qpdf-40f00122b811ca5c8788856f5baf4e5e088926eb.tar.zst |
Convert object parsing errors to warnings
QPDFObjectHandle::parseInternal now issues warnings instead of
throwing exceptions for all error conditions that it finds (except
internal logic errors) and has stronger recovery for things like
invalid tokens and malformed dictionaries. This should improve qpdf's
ability to recover from a wide range of broken files that currently
cause it to fail.
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDF.hh | 12 | ||||
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 4742275f..0788316d 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -522,6 +522,18 @@ class QPDF }; friend class Resolver; + // Warner class allows QPDFObjectHandle to create warnings + class Warner + { + friend class QPDFObjectHandle; + private: + static void warn(QPDF* qpdf, QPDFExc const& e) + { + qpdf->warn(e); + } + }; + friend class Warner; + // Pipe class is restricted to QPDF_Stream class Pipe { diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index bd1f1f19..0fc989a5 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -28,6 +28,7 @@ class QPDF; class QPDF_Dictionary; class QPDF_Array; class QPDFTokenizer; +class QPDFExc; class QPDFObjectHandle { @@ -623,6 +624,9 @@ class QPDFObjectHandle static void parseContentStream_internal( QPDFObjectHandle stream, ParserCallbacks* callbacks); + // Other methods + static void warn(QPDF*, QPDFExc const&); + bool initialized; QPDF* qpdf; // 0 for direct object |