diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-16 20:26:28 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-16 20:26:28 +0000 |
commit | 33906880888288fa552137fb43bf21bdc19cb187 (patch) | |
tree | 5737dfce95baa94a061ee2965e67aef628f955ec /core/fpdfapi/page | |
parent | 846fb0301a146319826a04c4a6e2fafadf92813a (diff) | |
download | pdfium-33906880888288fa552137fb43bf21bdc19cb187.tar.xz |
Fix some checks for FX_Realloc() failures.
FX_Realloc() never fails. So either remove the check or switch to
FX_TryRealloc().
Change-Id: I11fd02508add50db900a7502835018c2b61bcd09
Reviewed-on: https://pdfium-review.googlesource.com/30712
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_function.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp index bf5c3e065f..d4fad9c1ba 100644 --- a/core/fpdfapi/page/cpdf_function.cpp +++ b/core/fpdfapi/page/cpdf_function.cpp @@ -105,12 +105,11 @@ bool CPDF_Function::Init(CPDF_Object* pObj, std::set<CPDF_Object*>* pVisited) { uint32_t old_outputs = m_nOutputs; if (!v_Init(pObj, pVisited)) return false; + if (m_pRanges && m_nOutputs > old_outputs) { m_pRanges = FX_Realloc(float, m_pRanges, m_nOutputs * 2); - if (m_pRanges) { - memset(m_pRanges + (old_outputs * 2), 0, - sizeof(float) * (m_nOutputs - old_outputs) * 2); - } + memset(m_pRanges + (old_outputs * 2), 0, + sizeof(float) * (m_nOutputs - old_outputs) * 2); } return true; } |