summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-16 10:16:49 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-09-16 14:02:02 +0200
commit62680e9bec0a9a32659e9146e12e13d5fcafc0b4 (patch)
tree3671782feb2ce74ff294e8e958870808bef4efd2
parent10184fcab1f314e0861ad152b320ed1ee31ccdd5 (diff)
ofz#25696 OOM
Change-Id: Ia69e9ce1ca0156e960dddb7e0bf98dfd2be2d7cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102759 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--vcl/source/font/fontcharmap.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx
index f8c95e796b20..7225f385ad56 100644
--- a/vcl/source/font/fontcharmap.cxx
+++ b/vcl/source/font/fontcharmap.cxx
@@ -179,6 +179,12 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
{
int nSegCountX2 = GetUShort( pCmap + nOffset + 6 );
nRangeCount = nSegCountX2/2 - 1;
+ if (nRangeCount < 0)
+ {
+ SAL_WARN("vcl.gdi", "negative RangeCount");
+ nRangeCount = 0;
+ }
+
pCodePairs = new sal_UCS4[ nRangeCount * 2 ];
pStartGlyphs = new int[ nRangeCount ];
const unsigned char* pLimitBase = pCmap + nOffset + 14;