summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_render
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-02-12 18:21:21 -0800
committerWei Li <weili@chromium.org>2016-02-12 18:21:21 -0800
commit42a1bc02c0810c039afbcb62170c326f0e717320 (patch)
treea686d50142aaa5fbd19b0a4fde32f33377a74102 /core/src/fpdfapi/fpdf_render
parentf5f1399f1af3c5869bf6857a125552d4834c19da (diff)
downloadpdfium-42a1bc02c0810c039afbcb62170c326f0e717320.tar.xz
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 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp9
1 files changed, 3 insertions, 6 deletions
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<CPDF_Object*>(item.GetParam()));
- if (!CheckOCGVisible(pOCG)) {
- return FALSE;
- }
+ item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict &&
+ !CheckOCGVisible(item.GetParam())) {
+ return FALSE;
}
}
return TRUE;