зеркало из https://github.com/stride3d/freetype.git
[base] Fix a dereference of uninitialized variable in PIC mode.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): `glyph' must be set before derefering to obtain `library'. The initialization of `clazz', `glyph', `library' and NULL pointer check are reordered to minimize PIC conditonals.
This commit is contained in:
Родитель
0614febcec
Коммит
09f3e41c25
|
@ -1,3 +1,12 @@
|
|||
2012-01-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
[base] Fix a dereference of uninitialized variable in PIC mode.
|
||||
|
||||
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): `glyph' must be
|
||||
set before derefering to obtain `library'. The initialization
|
||||
of `clazz', `glyph', `library' and NULL pointer check are
|
||||
reordered to minimize PIC conditonals.
|
||||
|
||||
2012-01-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
[base] Insert explict cast for GCC 4.6 in PIC mode.
|
||||
|
|
|
@ -512,42 +512,42 @@
|
|||
FT_Error error = FT_Err_Ok;
|
||||
FT_Glyph glyph;
|
||||
FT_BitmapGlyph bitmap = NULL;
|
||||
|
||||
const FT_Glyph_Class* clazz;
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
FT_Library library = FT_GLYPH( glyph )->library;
|
||||
#endif
|
||||
/* FT_BITMAP_GLYPH_CLASS_GET derefers `library' in PIC mode */
|
||||
FT_Library library;
|
||||
|
||||
|
||||
/* check argument */
|
||||
if ( !the_glyph )
|
||||
goto Bad;
|
||||
|
||||
/* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
|
||||
/* then calling FT_Render_Glyph_Internal() */
|
||||
|
||||
glyph = *the_glyph;
|
||||
if ( !glyph )
|
||||
goto Bad;
|
||||
|
||||
clazz = glyph->clazz;
|
||||
clazz = glyph->clazz;
|
||||
library = glyph->library;
|
||||
if ( !library || !clazz )
|
||||
goto Bad;
|
||||
|
||||
/* when called with a bitmap glyph, do nothing and return successfully */
|
||||
if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )
|
||||
goto Exit;
|
||||
|
||||
if ( !clazz || !clazz->glyph_prepare )
|
||||
if ( !clazz->glyph_prepare )
|
||||
goto Bad;
|
||||
|
||||
/* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
|
||||
/* then calling FT_Render_Glyph_Internal() */
|
||||
|
||||
FT_MEM_ZERO( &dummy, sizeof ( dummy ) );
|
||||
FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) );
|
||||
dummy.internal = &dummy_internal;
|
||||
dummy.library = glyph->library;
|
||||
dummy.library = library;
|
||||
dummy.format = clazz->glyph_format;
|
||||
|
||||
/* create result bitmap glyph */
|
||||
error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET,
|
||||
error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET,
|
||||
(FT_Glyph*)(void*)&bitmap );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
|
Загрузка…
Ссылка в новой задаче