Inline call to QPDFObjectHandle::parse in QPDF::readObject

This commit is contained in:
m-holger 2022-09-28 16:58:42 +01:00 committed by Jay Berkenbilt
parent cb0a6be983
commit c63fb86c01
2 changed files with 7 additions and 9 deletions

View File

@ -455,7 +455,7 @@ class QPDFObjectHandle
// Construct an object as above by reading from the given // Construct an object as above by reading from the given
// InputSource at its current position and using the tokenizer you // InputSource at its current position and using the tokenizer you
// supply. Indirect objects and encrypted strings are permitted. // supply. Indirect objects and encrypted strings are permitted.
// This method is intended to be called by QPDF for parsing // This method was intended to be called by QPDF for parsing
// objects that are ready from the object's input stream. // objects that are ready from the object's input stream.
QPDF_DLL QPDF_DLL
static QPDFObjectHandle parse( static QPDFObjectHandle parse(

View File

@ -22,6 +22,7 @@
#include <qpdf/QPDFExc.hh> #include <qpdf/QPDFExc.hh>
#include <qpdf/QPDFLogger.hh> #include <qpdf/QPDFLogger.hh>
#include <qpdf/QPDFObject_private.hh> #include <qpdf/QPDFObject_private.hh>
#include <qpdf/QPDFParser.hh>
#include <qpdf/QPDF_Array.hh> #include <qpdf/QPDF_Array.hh>
#include <qpdf/QPDF_Dictionary.hh> #include <qpdf/QPDF_Dictionary.hh>
#include <qpdf/QPDF_Null.hh> #include <qpdf/QPDF_Null.hh>
@ -530,7 +531,7 @@ void
QPDF::inParse(bool v) QPDF::inParse(bool v)
{ {
if (this->m->in_parse == v) { if (this->m->in_parse == v) {
// This happens of QPDFObjectHandle::parseInternal tries to // This happens if QPDFParser::parse tries to
// resolve an indirect object while it is parsing. // resolve an indirect object while it is parsing.
throw std::logic_error( throw std::logic_error(
"QPDF: re-entrant parsing detected. This is a qpdf bug." "QPDF: re-entrant parsing detected. This is a qpdf bug."
@ -1413,13 +1414,10 @@ QPDF::readObject(
decrypter_ph = std::make_shared<StringDecrypter>(this, og); decrypter_ph = std::make_shared<StringDecrypter>(this, og);
decrypter = decrypter_ph.get(); decrypter = decrypter_ph.get();
} }
QPDFObjectHandle object = QPDFObjectHandle::parse( auto object =
input, QPDFParser(
this->m->last_object_description, input, m->last_object_description, m->tokenizer, decrypter, this)
this->m->tokenizer, .parse(empty, false);
empty,
decrypter,
this);
if (empty) { if (empty) {
// Nothing in the PDF spec appears to allow empty objects, but // Nothing in the PDF spec appears to allow empty objects, but
// they have been encountered in actual PDF files and Adobe // they have been encountered in actual PDF files and Adobe