diff options
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 6d4f10ce..35a4962a 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -152,6 +152,16 @@ QPDFObjectHandle::ParserCallbacks::handleObject( } void +QPDFObjectHandle::ParserCallbacks::handleWarning() +{ +} + +void +QPDFObjectHandle::ParserCallbacks::handleEOF() +{ +} + +void QPDFObjectHandle::ParserCallbacks::contentSize(size_t) { // Ignore by default; overriding this is optional. @@ -1847,10 +1857,15 @@ QPDFObjectHandle::parseContentStream_internal( pipeContentStreams(&buf, description, all_description); PointerHolder<Buffer> stream_data = buf.getBuffer(); callbacks->contentSize(stream_data->getSize()); + QPDF* context = getOwningQPDF(); + if ((! context) && isArray() && (getArrayNItems() > 0)) + { + context = getArrayItem(0).getOwningQPDF(); + } try { parseContentStream_data(stream_data, all_description, - callbacks, getOwningQPDF()); + callbacks, context); } catch (TerminateParsing&) { @@ -1881,9 +1896,15 @@ QPDFObjectHandle::parseContentStream_data( tokenizer.readToken(input, "content", true); qpdf_offset_t offset = input->getLastOffset(); input->seek(offset, SEEK_SET); + size_t before_nwarnings = (context ? context->numWarnings() : 0); QPDFObjectHandle obj = parseInternal(input, "content", tokenizer, empty, 0, context, true); + size_t after_nwarnings = (context ? context->numWarnings() : 0); + if (after_nwarnings > before_nwarnings) + { + callbacks->handleWarning(); + } if (! obj.isInitialized()) { // EOF @@ -1910,6 +1931,7 @@ QPDFObjectHandle::parseContentStream_data( QPDFExc(qpdf_e_damaged_pdf, input->getName(), "stream data", input->tell(), "EOF found while reading inline image")); + callbacks->handleWarning(); } else { |