diff options
author | Lei Zhang <thestig@chromium.org> | 2017-10-06 02:18:04 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-06 18:57:12 +0000 |
commit | b962ecceb7a7d961fdebc1bdf314d450cc6bf204 (patch) | |
tree | 8cdc205b588c4eb29f967b766d3fd20e020b936b /core/fpdfapi/render/cpdf_imagerenderer.cpp | |
parent | d103b96635a27abf93cb1a9a476c9263603bd203 (diff) | |
download | pdfium-b962ecceb7a7d961fdebc1bdf314d450cc6bf204.tar.xz |
Fix a crash in CPDF_ImageRenderer.chromium/3236chromium/3235
BUG=chromium:770884
Change-Id: Ia609db04b0e596649fbda087290b7da040211f14
Reviewed-on: https://pdfium-review.googlesource.com/15790
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_imagerenderer.cpp')
-rw-r--r-- | core/fpdfapi/render/cpdf_imagerenderer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index 6efc62c84b..1351597279 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -106,9 +106,12 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() { m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject.Get()); } else if (m_pRenderStatus->GetRenderOptions()->ColorModeIs( CPDF_RenderOptions::kGray)) { - m_pClone = m_pDIBSource->Clone(nullptr); - m_pClone->ConvertColorScale(0xffffff, 0); - m_pDIBSource = m_pClone; + RetainPtr<CFX_DIBitmap> pClone = m_pDIBSource->Clone(nullptr); + if (!pClone) + return false; + + pClone->ConvertColorScale(0xffffff, 0); + m_pDIBSource = pClone; } m_Flags = 0; if (m_pRenderStatus->GetRenderOptions()->HasFlag(RENDER_FORCE_DOWNSAMPLE)) |