summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font
diff options
context:
space:
mode:
authorkcwu <kcwu@chromium.org>2016-09-26 12:21:01 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-26 12:21:01 -0700
commitddf6293e4db200cda56b19eb99b1c03953d5baca (patch)
tree5b1b3eeadd7a54c29f193f65f42275ffc0747775 /core/fpdfapi/fpdf_font
parenta177d1c08e600f1e48938cad02609042809b3a36 (diff)
downloadpdfium-ddf6293e4db200cda56b19eb99b1c03953d5baca.tar.xz
Fix memory leak in cmap parsing
found by libfuzzer Review-Url: https://codereview.chromium.org/2366143002
Diffstat (limited to 'core/fpdfapi/fpdf_font')
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index f3c5f05d51..93d29d9bc7 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -413,6 +413,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
if (nSegs > 1) {
m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes;
m_pCMap->m_nCodeRanges = nSegs;
+ FX_Free(m_pCMap->m_pLeadingBytes);
m_pCMap->m_pLeadingBytes =
FX_Alloc2D(uint8_t, nSegs, sizeof(CMap_CodeRange));
FXSYS_memcpy(m_pCMap->m_pLeadingBytes, m_CodeRanges.GetData(),