diff options
author | David Turner <david@freetype.org> | 2006-05-02 09:00:29 +0000 |
---|---|---|
committer | David Turner <david@freetype.org> | 2006-05-02 09:00:29 +0000 |
commit | 9ca782569c218e18c420e7c13bdbdf3e9a75c87a (patch) | |
tree | b77a69dde13ce63d1ed098d70a420f659fb19e70 /src/winfonts/winfnt.c | |
parent | 264f307e66f9c2763b2e31b0a4e7513b7866745a (diff) | |
download | freetype2-9ca782569c218e18c420e7c13bdbdf3e9a75c87a.tar.gz |
* include/freetype/internal/ftmemory.h, src/base/ftbitmap.c,
src/base/ftmac.c, src/base/ftrfork.c, src/lzw/ftzopen.c,
src/raster/ftrend1.c, src/sfnt/ttpost.c, src/truetype/ttgxvar.c,
src/type42/t42parse.c, src/winfonts/winfnt.c: hardening the code
against out-of-bounds conditions when allocating arrays. This is
for the cases where FT_NEW_ARRAY and FT_RENEW_ARRAY are not used
already. Introducing the new FT_ALLOC_MULT and FT_REALLOC_MULT
macros.
Diffstat (limited to 'src/winfonts/winfnt.c')
-rw-r--r-- | src/winfonts/winfnt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 553cddbc0..3523b14f8 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -531,7 +531,7 @@ /* reserve one slot for the .notdef glyph at index 0 */ root->num_glyphs = font->header.last_char - - font->header.first_char + 1 + 1; + font->header.first_char + 1 + 1; /* Some broken fonts don't delimit the face name with a final */ /* NULL byte -- the frame is erroneously one byte too small. */ @@ -540,14 +540,18 @@ family_size = font->header.file_size - font->header.face_name_offset; if ( FT_ALLOC( font->family_name, family_size + 1 ) ) goto Fail; + FT_MEM_COPY( font->family_name, font->fnt_frame + font->header.face_name_offset, family_size ); + font->family_name[family_size] = '\0'; + if ( FT_REALLOC( font->family_name, family_size, ft_strlen( font->family_name ) + 1 ) ) goto Fail; + root->family_name = font->family_name; root->style_name = (char *)"Regular"; @@ -693,7 +697,7 @@ /* note: since glyphs are stored in columns and not in rows we */ /* can't use ft_glyphslot_set_bitmap */ - if ( FT_ALLOC( bitmap->buffer, pitch * bitmap->rows ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, pitch, bitmap->rows ) ) goto Exit; column = (FT_Byte*)bitmap->buffer; |