summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_colorspace.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-17 16:16:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-17 16:16:39 +0000
commit8cfcb7da37352b22517892e6eabcedb77676cdf7 (patch)
tree4195ccdd962b1f5e1525d461c1b461b9f263a3cd /core/fpdfapi/page/cpdf_colorspace.cpp
parenta4c7ac479d291fc3373b9c2f8f25302ecd53b0d5 (diff)
downloadpdfium-8cfcb7da37352b22517892e6eabcedb77676cdf7.tar.xz
Fix nits in CPDF_Function and derived classes.
- Switch away from FX_Alloc2D() when it is safe to do so. - Use FX_SAFE_SIZE_T to avoid a potential underflow with FX_Realloc(). - Mark the v_Call() input as const. - Check Call() and v_Call() return results. Change-Id: I6ec3122b23e0f137f88aa8d85a9675154a1b1706 Reviewed-on: https://pdfium-review.googlesource.com/30802 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_colorspace.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index 7fdee86dc5..8ba2d8b4d5 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -1214,8 +1214,7 @@ bool CPDF_SeparationCS::GetRGB(const float* pBuf,
CFX_FixedBufGrow<float, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
- m_pFunc->Call(pBuf, 1, results, &nresults);
- if (nresults == 0)
+ if (!m_pFunc->Call(pBuf, 1, results, &nresults) || nresults == 0)
return false;
if (m_pAltCS)
@@ -1281,9 +1280,10 @@ bool CPDF_DeviceNCS::GetRGB(const float* pBuf,
CFX_FixedBufGrow<float, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
- m_pFunc->Call(pBuf, CountComponents(), results, &nresults);
- if (nresults == 0)
+ if (!m_pFunc->Call(pBuf, CountComponents(), results, &nresults) ||
+ nresults == 0) {
return false;
+ }
return m_pAltCS->GetRGB(results, R, G, B);
}