Skip to content

Commit f9e8bce

Browse files
committed
[core] Fix crash in text primitive occurring under certain circumstances.
1 parent 64e6987 commit f9e8bce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/core/shape/truetype.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ bool ProcessFormat4Glyph(TrueTypeFont *ffile, GlyphIndex& glyphIndex, int cmapId
16571657

16581658
if (cmap4Info->idRangeOffset[i] == 0)
16591659
{
1660-
glyphIndex = search_codepoint + cmap4Info->idDelta[i];
1660+
glyphIndex = (search_codepoint + cmap4Info->idDelta[i]) & 0xFFFF;
16611661
}
16621662
else
16631663
{
@@ -1674,7 +1674,7 @@ bool ProcessFormat4Glyph(TrueTypeFont *ffile, GlyphIndex& glyphIndex, int cmapId
16741674
glyphIndex = READUSHORT(*ffile->file);
16751675

16761676
if (glyphIndex != 0)
1677-
glyphIndex += cmap4Info->idDelta[i];
1677+
glyphIndex = (glyphIndex + cmap4Info->idDelta[i]) & 0xFFFF;
16781678
}
16791679
}
16801680
break;

0 commit comments

Comments
 (0)