Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions schrift.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ sft_kerning(const SFT *sft, SFT_Glyph leftGlyph, SFT_Glyph rightGlyph,
return -1;
numPairs = getu16(sft->font, offset);
offset += 8;
if (!is_safe_offset(sft->font, offset, (uint_fast32_t) numPairs * 6))
return -1;
/* Look up character code pair via binary search. */
key[0] = (leftGlyph >> 8) & 0xFF;
key[1] = leftGlyph & 0xFF;
Expand Down Expand Up @@ -866,6 +868,10 @@ cmap_fmt12_13(SFT_Font *font, uint_fast32_t table, SFT_UChar charCode, SFT_Glyph

numEntries = getu32(font, table + 12);

/* Ensure the declared number of groups fits within the subtable. */
if (numEntries > (len - 16) / 12)
return -1;

for (i = 0; i < numEntries; ++i) {
uint32_t firstCode, lastCode, glyphOffset;
firstCode = getu32(font, table + (i * 12) + 16);
Expand Down