summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_syntax_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_syntax_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 48d77c2cbd..1b81b98c96 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -386,8 +386,10 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObject(
if (bIsNumber) {
CFX_ByteString nextword2 = GetNextWord(nullptr);
if (nextword2 == "R") {
- return pdfium::MakeUnique<CPDF_Reference>(pObjList,
- FXSYS_atoui(word.c_str()));
+ uint32_t objnum = FXSYS_atoui(word.c_str());
+ if (objnum == CPDF_Object::kInvalidObjNum)
+ return nullptr;
+ return pdfium::MakeUnique<CPDF_Reference>(pObjList, objnum);
}
}
m_Pos = SavedPos;
@@ -505,8 +507,10 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectForStrict(
if (bIsNumber) {
CFX_ByteString nextword2 = GetNextWord(nullptr);
if (nextword2 == "R") {
- return pdfium::MakeUnique<CPDF_Reference>(pObjList,
- FXSYS_atoui(word.c_str()));
+ uint32_t objnum = FXSYS_atoui(word.c_str());
+ if (objnum == CPDF_Object::kInvalidObjNum)
+ return nullptr;
+ return pdfium::MakeUnique<CPDF_Reference>(pObjList, objnum);
}
}
m_Pos = SavedPos;