diff options
author | Albert Astals Cid <aacid@kde.org> | 2023-04-02 12:19:44 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2023-04-02 12:19:44 +0200 |
commit | 341687022c6f34d6979bfebe34b8655679198d68 (patch) | |
tree | f9c1241db291fe81147d1b5e62c640965aedf8ae | |
parent | 4c6da80ab5a54df72c0243d32a3976b683441d5e (diff) |
GfxCIDFont::getCodeToGIDMap: Fix uninitialized memory reads
Only initialize tumap when we're actually going to fill it
-rw-r--r-- | poppler/GfxFont.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index cc2ce038..912b9a49 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -2179,7 +2179,6 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *codeToGIDLen) } } 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 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *codeToGIDLen) 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; |