From 73ecd39debe850c11293fcf175c1e2b637edc5f3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 19 Jun 2019 15:06:40 +0200 Subject: distancefieldgenerator: Fix failure reading CMAP for some fonts If all the range offsets in the type 4 subtable in CMAP is equal to 0, there is no need for a glyph ID array, so this array can actually have zero length. We did not account for this, and would fail to read those fonts. Task-number: QTBUG-76188 Change-Id: I11873fba7214d179af1fcd7ccff9a9fd1c72ce10 Reviewed-by: Simon Hausmann --- src/distancefieldgenerator/distancefieldmodelworker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/distancefieldgenerator/distancefieldmodelworker.cpp b/src/distancefieldgenerator/distancefieldmodelworker.cpp index d140ff219..b76f3b707 100644 --- a/src/distancefieldgenerator/distancefieldmodelworker.cpp +++ b/src/distancefieldgenerator/distancefieldmodelworker.cpp @@ -148,7 +148,7 @@ void DistanceFieldModelWorker::readCmapSubtable(const CmapSubtable4 *subtable, c const qint16 *idDeltas = reinterpret_cast(startCodes + segCount); const quint16 *idRangeOffsets = reinterpret_cast(idDeltas + segCount); const quint16 *glyphIdArray = idRangeOffsets + segCount; - if (glyphIdArray >= end) { + if (glyphIdArray > end) { emit error(tr("End of cmap table reached when parsing subtable format '4'")); return; } -- cgit v1.2.3