summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-09 09:59:02 -0800
committerLei Zhang <thestig@chromium.org>2015-11-09 09:59:02 -0800
commit8698aff8381399e82bafa892ed9f0e605065e45c (patch)
treebed6d00fd77f6617a29e114335a48172cb1d7b68
parent4589243c204d6a8ef938f14d92c97b94aae38177 (diff)
downloadpdfium-8698aff8381399e82bafa892ed9f0e605065e45c.tar.xz
Merge to XFA: Add some nullptr checks that were missing from commit f7992b39.
BUG=pdfium:268 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1425293010 . (cherry picked from commit a8f5b7b5e7501bdcfba585fc8af76c4a0fab22cb) Review URL: https://codereview.chromium.org/1418823008 .
-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 e49835496c..e8b300027c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -851,7 +851,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);