Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20aff4b

Browse files
authored
Merge pull request #9239 from QuLogic/sanitizer-fixes
Sanitizer fixes
2 parents c7f3def + 0067441 commit 20aff4b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

extern/ttconv/pprdrv_tt.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ BYTE *GetTable(struct TTFONT *font, const char *name)
137137

138138
offset = getULONG( ptr + 8 );
139139
length = getULONG( ptr + 12 );
140-
table = (BYTE*)calloc( sizeof(BYTE), length );
140+
table = (BYTE*)calloc( sizeof(BYTE), length + 2 );
141141

142142
try
143143
{
@@ -160,6 +160,9 @@ BYTE *GetTable(struct TTFONT *font, const char *name)
160160
free(table);
161161
throw;
162162
}
163+
/* Always NUL-terminate; add two in case of UTF16 strings. */
164+
table[length] = '\0';
165+
table[length + 1] = '\0';
163166
return table;
164167
}
165168

src/ft2font.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,7 @@ void FT2Font::set_text(
601601
FT_Bool use_kerning = FT_HAS_KERNING(face);
602602
FT_UInt previous = 0;
603603

604-
glyphs.resize(0);
605-
pen.x = 0;
606-
pen.y = 0;
604+
clear();
607605

608606
bbox.xMin = bbox.yMin = 32000;
609607
bbox.xMax = bbox.yMax = -32000;

0 commit comments

Comments
 (0)