Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
index ca3a5f67a24811dacd0f0b10a426d164f7f7f4d7..61d9749c8e153aeb7388a1406ee23e74880fad50 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
@@ -987,16 +987,17 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { |
CPDF_Object* pObject = ParseIndirectObjectAt(m_pDocument, *pos, 0, nullptr); |
if (!pObject) |
return FALSE; |
- |
if (m_pDocument) { |
+ FX_BOOL bInserted = FALSE; |
CPDF_Dictionary* pDict = m_pDocument->GetRoot(); |
if (!pDict || pDict->GetObjNum() != pObject->m_ObjNum) { |
- m_pDocument->InsertIndirectObject(pObject->m_ObjNum, pObject); |
+ bInserted = m_pDocument->InsertIndirectObject(pObject->m_ObjNum, pObject); |
} else { |
if (pObject->IsStream()) |
pObject->Release(); |
- return FALSE; |
} |
+ if (!bInserted) |
+ return FALSE; |
} |
CPDF_Stream* pStream = pObject->AsStream(); |
@@ -4553,7 +4554,8 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { |
if (!pPageDict) { |
return nullptr; |
} |
- m_pDocument->InsertIndirectObject(dwObjNum, pPageDict); |
+ if (!m_pDocument->InsertIndirectObject(dwObjNum, pPageDict)) |
+ return nullptr; |
return pPageDict->GetDict(); |
} |
} |