diff options
author | Jay Berkenbilt <ejb@ql.org> | 2017-08-09 03:44:37 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2017-08-11 01:01:41 +0200 |
commit | ef8ae5449dc30782451beba64fdd0af86e1cb931 (patch) | |
tree | 5ed173f9f86c578ba1ee08b06f63f23ecad2369a /include | |
parent | 8320d16cd20240cc35ec84de6bb89f2d9431ea2d (diff) | |
download | qpdf-ef8ae5449dc30782451beba64fdd0af86e1cb931.tar.zst |
Allow QPDFTokenizer::readToken to return bad tokens
Sometimes we want to ignore bad tokens rather than having them throw
an exception. A coverage case is commented out here and added in a
later commit.
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDF.hh | 3 | ||||
-rw-r--r-- | include/qpdf/QPDFTokenizer.hh | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 58f6af6e..f57789a0 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -666,7 +666,8 @@ class QPDF size_t recoverStreamLength( PointerHolder<InputSource> input, int objid, int generation, qpdf_offset_t stream_offset); - QPDFTokenizer::Token readToken(PointerHolder<InputSource>); + QPDFTokenizer::Token readToken(PointerHolder<InputSource>, + bool allow_bad = false); QPDFObjectHandle readObjectAtOffset( bool attempt_recovery, diff --git a/include/qpdf/QPDFTokenizer.hh b/include/qpdf/QPDFTokenizer.hh index 2f3dfec2..39cb9225 100644 --- a/include/qpdf/QPDFTokenizer.hh +++ b/include/qpdf/QPDFTokenizer.hh @@ -138,7 +138,8 @@ class QPDFTokenizer // exception thrown if there is an error. QPDF_DLL Token readToken(PointerHolder<InputSource> input, - std::string const& context); + std::string const& context, + bool allow_bad = false); private: void reset(); |