diff options
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 9bb9bf22d7..029851570a 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -72,8 +72,9 @@ CPDF_Parser::~CPDF_Parser() { } uint32_t CPDF_Parser::GetLastObjNum() const { - const uint32_t size = m_CrossRefTable->GetSize(); - return size ? size - 1 : 0; + return m_CrossRefTable->objects_info().empty() + ? 0 + : m_CrossRefTable->objects_info().rbegin()->first; } bool CPDF_Parser::IsValidObjectNumber(uint32_t objnum) const { @@ -114,8 +115,8 @@ bool CPDF_Parser::IsObjectFree(uint32_t objnum) const { return GetObjectType(objnum) == ObjectType::kFree; } -void CPDF_Parser::ShrinkObjectMap(uint32_t max_size) { - m_CrossRefTable->ShrinkObjectMap(max_size); +void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) { + m_CrossRefTable->ShrinkObjectMap(objnum); } bool CPDF_Parser::InitSyntaxParser( @@ -741,7 +742,8 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) { const uint8_t* segstart = pData + segindex * totalWidth; FX_SAFE_UINT32 dwMaxObjNum = startnum; dwMaxObjNum += count; - uint32_t dwV5Size = m_CrossRefTable->GetSize(); + uint32_t dwV5Size = + m_CrossRefTable->objects_info().empty() ? 0 : GetLastObjNum() + 1; if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) continue; |