summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-07 12:29:32 +0000
committerAndras Timar <andras.timar@collabora.com>2018-03-06 21:57:20 +0100
commit69d95e3138277d17cd53e335cc71b8ec185f4d1e (patch)
tree1d2a530a3c787da29794334c76c1b7a640ddef03
parent7b8cf370308b25d4d0363feecaa2e730ca321a1a (diff)
sanity check cmap table size
Change-Id: I010c2fd221bcd86a62efd9996a0c34930828cb6d Reviewed-on: https://gerrit.libreoffice.org/49350 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit a39e2684d48046d18bd486d145b9d4a3d2044e8a)
-rw-r--r--vcl/source/fontsubset/sft.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index d4a8b5a764a6..3da8634196b5 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1232,6 +1232,12 @@ static void FindCmap(TrueTypeFont *ttf)
{
const sal_uInt8* table = getTable(ttf, O_cmap);
sal_uInt32 table_size = getTableSize(ttf, O_cmap);
+ if (table_size < 4)
+ {
+ SAL_WARN("vcl.fonts", "Parsing error in " << OUString::createFromAscii(ttf->fname) <<
+ "cmap table size too short");
+ return;
+ }
sal_uInt16 ncmaps = GetUInt16(table, 2);
sal_uInt32 AppleUni = 0; // Apple Unicode
sal_uInt32 ThreeZero = 0; /* MS Symbol */