diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-06-07 19:32:21 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-07 19:32:21 +0000 |
commit | 1b74dee4616d22f3cfb00fa57cb7af8a190e6d7e (patch) | |
tree | 5aa6f2894fabc24b5095ed29ff94c8d2ef3f960a /core/fpdfapi | |
parent | f51a4767ee7854991d94d6814aa13f5763f05760 (diff) | |
download | pdfium-1b74dee4616d22f3cfb00fa57cb7af8a190e6d7e.tar.xz |
Return from GenerateContent() if m_pObjHolder->GetFormDict() is null.
Currently this case will lead to a crash, as pContent will be null
and pPageDict will be dereferenced.
This is a theoritical case, there is no concrete test case.
Change-Id: Ieedab26cd9f419ab49aa2cde15f1b8e3c230b61d
Reviewed-on: https://pdfium-review.googlesource.com/34430
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 107f54efdb..6c284e1d27 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -82,8 +82,10 @@ void CPDF_PageContentGenerator::GenerateContent() { // Add buffer to a stream in page's 'Contents' CPDF_Dictionary* pPageDict = m_pObjHolder->GetFormDict(); - CPDF_Object* pContent = - pPageDict ? pPageDict->GetObjectFor("Contents") : nullptr; + if (!pPageDict) + return; + + CPDF_Object* pContent = pPageDict->GetObjectFor("Contents"); CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>(); pStream->SetData(&buf); if (pContent) { |