GfxCIDFont::getCodeToGIDMap: Fix uninitialized memory reads
Only initialize tumap when we're actually going to fill it
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index cc2ce03..912b9a4 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -2179,7 +2179,6 @@
}
}
const unsigned int n = 65536;
- tumap = new Unicode[n];
humap = new Unicode[n * N_UCS_CANDIDATES];
memset(humap, 0, sizeof(Unicode) * n * N_UCS_CANDIDATES);
if (lp->collection != nullptr) {
@@ -2187,6 +2186,7 @@
GooString tname(lp->toUnicodeMap);
if ((tctu = CharCodeToUnicode::parseCMapFromFile(&tname, 16)) != nullptr) {
+ tumap = new Unicode[n];
CharCode cid;
for (cid = 0; cid < n; cid++) {
int len;