diff options
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index aaec4c7708..38e857f22f 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -634,30 +634,14 @@ std::unique_ptr<CPDF_Object> CPDF_DataAvail::ParseIndirectObjectAt( FX_FILESIZE pos, uint32_t objnum, CPDF_IndirectObjectHolder* pObjList) { - FX_FILESIZE SavedPos = m_syntaxParser.GetPos(); + const FX_FILESIZE SavedPos = m_syntaxParser.GetPos(); m_syntaxParser.SetPos(pos); - - bool bIsNumber; - ByteString word = m_syntaxParser.GetNextWord(&bIsNumber); - if (!bIsNumber) - return nullptr; - - uint32_t parser_objnum = FXSYS_atoui(word.c_str()); - if (objnum && parser_objnum != objnum) - return nullptr; - - word = m_syntaxParser.GetNextWord(&bIsNumber); - if (!bIsNumber) - return nullptr; - - if (m_syntaxParser.GetKeyword() != "obj") { - m_syntaxParser.SetPos(SavedPos); - return nullptr; - } - - std::unique_ptr<CPDF_Object> pObj = m_syntaxParser.GetObjectBody(pObjList); + std::unique_ptr<CPDF_Object> result = m_syntaxParser.GetIndirectObject( + pObjList, CPDF_SyntaxParser::ParseType::kLoose); m_syntaxParser.SetPos(SavedPos); - return pObj; + return (result && (!objnum || result->GetObjNum() == objnum)) + ? std::move(result) + : nullptr; } CPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() { |