[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] Crash in cffdriver.c
From: |
Mikey Anbary |
Subject: |
[Devel] Crash in cffdriver.c |
Date: |
Thu, 19 Jun 2003 13:13:00 +0300 |
Hi
With some open type fonts ( if an example is needed pls email ) I had to add
another test for NULL or I would crash .
freetype-2.1.4\src\cff\cffdrivr.c
static FT_Error
cff_get_glyph_name( CFF_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max )
{
CFF_Font font = (CFF_Font)face->extra.data;
FT_Memory memory = FT_FACE_MEMORY( face );
FT_String* gname;
FT_UShort sid;
PSNames_Service psnames;
FT_Error error;
psnames = (PSNames_Service)FT_Get_Module_Interface(
face->root.driver->root.library, "psnames" );
if ( !psnames )
{
FT_ERROR(( "cff_get_glyph_name:" ));
FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
FT_ERROR(( " " ));
FT_ERROR(( " without the `PSNames' module\n" ));
error = CFF_Err_Unknown_File_Format;
goto Exit;
}
/* first, locate the sid in the charset table */
sid = font->charset.sids[glyph_index];
/* now, lookup the name itself */
gname = cff_index_get_sid_string( &font->string_index, sid, psnames );
if(gname == NULL ) <<< new lines
{
goto Exit;
}
if ( buffer_max > 0 )
{
FT_UInt len = (FT_UInt)ft_strlen( gname );
if ( len >= buffer_max )
len = buffer_max - 1;
FT_MEM_COPY( buffer, gname, len ); << crash here
((FT_Byte*)buffer)[len] = 0;
}
FT_FREE ( gname );
error = CFF_Err_Ok;
Exit:
return error;
}
All the best
Mikey
- [Devel] Crash in cffdriver.c,
Mikey Anbary <=