summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_parser.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2018-08-02 11:01:08 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-02 11:01:08 +0000
commitb07deb3fc1f54bd700a66df573bfcbc4bcc1d787 (patch)
tree1da57aa7633b2059e28afb2cb41227644f4e87ac /core/fpdfapi/parser/cpdf_parser.cpp
parent649929af2140621d7bc50a532704f5d7be81637e (diff)
downloadpdfium-b07deb3fc1f54bd700a66df573bfcbc4bcc1d787.tar.xz
Rework of CPDF_Parser::GetLastObjNum.
Change-Id: I0481774858a9d9823580e1207807e35be8a9eea9 Reviewed-on: https://pdfium-review.googlesource.com/36270 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index e93f293f84..cb262bd1eb 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -72,9 +72,8 @@ CPDF_Parser::~CPDF_Parser() {
}
uint32_t CPDF_Parser::GetLastObjNum() const {
- return m_CrossRefTable->objects_info().empty()
- ? 0
- : m_CrossRefTable->objects_info().rbegin()->first;
+ const uint32_t size = m_CrossRefTable->GetSize();
+ return size ? size - 1 : 0;
}
bool CPDF_Parser::IsValidObjectNumber(uint32_t objnum) const {
@@ -115,8 +114,8 @@ bool CPDF_Parser::IsObjectFree(uint32_t objnum) const {
return GetObjectType(objnum) == ObjectType::kFree;
}
-void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) {
- m_CrossRefTable->ShrinkObjectMap(objnum);
+void CPDF_Parser::ShrinkObjectMap(uint32_t max_size) {
+ m_CrossRefTable->ShrinkObjectMap(max_size);
}
bool CPDF_Parser::InitSyntaxParser(
@@ -746,8 +745,7 @@ 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->objects_info().empty() ? 0 : GetLastObjNum() + 1;
+ uint32_t dwV5Size = m_CrossRefTable->GetSize();
if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size)
continue;