[Libreoffice-commits] core.git: vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 22 15:17:42 UTC 2021


 vcl/source/fontsubset/sft.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 04edde93cb22da676cf2e8473012742b63cebe55
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Mar 22 11:30:32 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Mar 22 16:16:48 2021 +0100

    cid#1474183 Untrusted allocation size
    
    instead of allocating a block of zeros, flag via the vector as empty
    to return zero
    
    Change-Id: Ia68b037bb1600ba73f4ea5dcc8892650bede34a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112884
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 61ff497cbde4..65cc77f3ba4b 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1160,6 +1160,8 @@ void CloseTTFont(TrueTypeFont* ttf) { delete ttf; }
 
 sal_uInt32 AbstractTrueTypeFont::glyphOffset(sal_uInt32 glyphID) const
 {
+    if (m_aGlyphOffsets.empty()) // the O_CFF and Bitmap cases
+        return 0;
     return m_aGlyphOffsets[glyphID];
 }
 
@@ -1200,13 +1202,11 @@ SFErrCodes AbstractTrueTypeFont::indexGlyphData()
             m_nGlyphs = k;
 
         m_aGlyphOffsets.clear();
-        m_aGlyphOffsets.resize(m_nGlyphs + 1, 0);
         /* TODO: implement to get subsetting */
     }
     else {
         // Bitmap font, accept for now.
         m_aGlyphOffsets.clear();
-        m_aGlyphOffsets.resize(m_nGlyphs + 1, 0);
         /* TODO: implement to get subsetting */
     }
 


More information about the Libreoffice-commits mailing list