summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-07 12:29:32 +0000
committerMichael Stahl <Michael.Stahl@cib.de>2019-08-27 14:12:28 +0200
commit2502971ea5d99e3f538a6d89853cc641c130ceb8 (patch)
treeb0dc24a6aabe624f04a160318e611ffe77e234cd
parentset Referer on link mediadescriptor (diff)
downloadcore-2502971ea5d99e3f538a6d89853cc641c130ceb8.tar.gz
core-2502971ea5d99e3f538a6d89853cc641c130ceb8.zip
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>
-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 2385d2676033..0d24beaf4428 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1245,6 +1245,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, 1);
sal_uInt32 AppleUni = 0; // Apple Unicode
sal_uInt32 ThreeZero = 0; /* MS Symbol */