From 42a1bc02c0810c039afbcb62170c326f0e717320 Mon Sep 17 00:00:00 2001 From: Wei Li Date: Fri, 12 Feb 2016 18:21:21 -0800 Subject: Fix the way to access marked content. When there is no dictionary for marked content, it potientially may cause crash. But it is not happening now since 1) we now check for the returned dict parameter 2) the alloc function in pdfium does zero initialization. BUG=pdfium:67 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1695633004 . --- core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'core/src/fpdfapi/fpdf_render') diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 35d62ce0b3..eeee03485a 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -1395,12 +1395,9 @@ FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) { for (int i = 0; i < nItems; i++) { CPDF_ContentMarkItem& item = pData->GetItem(i); if (item.GetName() == "OC" && - item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) { - CPDF_Dictionary* pOCG = - ToDictionary(static_cast(item.GetParam())); - if (!CheckOCGVisible(pOCG)) { - return FALSE; - } + item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && + !CheckOCGVisible(item.GetParam())) { + return FALSE; } } return TRUE; -- cgit v1.2.3