[poppler] poppler/GfxFont.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 3 09:29:36 UTC 2023


 poppler/GfxFont.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 341687022c6f34d6979bfebe34b8655679198d68
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Apr 2 12:19:44 2023 +0200

    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 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;


More information about the poppler mailing list