summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-09 09:51:30 -0800
committerLei Zhang <thestig@chromium.org>2015-11-09 09:51:30 -0800
commita8f5b7b5e7501bdcfba585fc8af76c4a0fab22cb (patch)
treeee84f43d83d3337b4001ca50ef7360a1dbb1f5cb
parent2ce28d26ad16e11828b19f602fcc0ff625a23345 (diff)
downloadpdfium-a8f5b7b5e7501bdcfba585fc8af76c4a0fab22cb.tar.xz
Add some nullptr checks that were missing from commit f7992b39.
BUG=pdfium:268 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1425293010 .
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 187d6152e9..9adfdb21a4 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -92,7 +92,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj(
m_pSyntax->ReadNextObject());
if (!key.IsEmpty()) {
- FX_DWORD dwObjNum = pObj->GetObjNum();
+ FX_DWORD dwObjNum = pObj ? pObj->GetObjNum() : 0;
if (dwObjNum)
pDict->SetAtReference(key, m_pDocument, dwObjNum);
else
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 26f5595eaf..96f15ecb9d 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -852,7 +852,8 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
CFX_ByteString key;
CPDF_Object* pElement =
pTrailer->GetNextElement(pos, key);
- FX_DWORD dwObjNum = pElement->GetObjNum();
+ FX_DWORD dwObjNum =
+ pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
m_pTrailer->SetAtReference(key, m_pDocument,
dwObjNum);