ftpatent: Fix a bug by wrong usage of service->table_info().

This commit is contained in:
suzuki toshiya 2009-06-29 03:09:17 +09:00
parent 24370d67f5
commit ad289d139f
5 changed files with 29 additions and 7 deletions

View File

@ -1,3 +1,18 @@
2009-06-28 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
ftpatent: Fix a bug by wrong usage of service->table_info().
http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html
* include/freetype/internal/services/svsfnt.h: Extend
FT_SFNT_TableInfoFunc() to take new argument to obtain the offset
to the specified table.
* src/sfnt/sfdriver.c (sfnt_table_info): Extend to return the
table-offset to the caller function.
* src/base/ftpatent.c (_tt_check_patents_in_table): Use new
service->table_info().
* src/base/ftobjs.c (FT_Sfnt_Table_Info): Synchronize to new
service->table_info().
2009-06-28 Werner Lemberg <wl@gnu.org>
[psaux, cff] Protect against nested `seac' calls.

View File

@ -58,6 +58,7 @@ FT_BEGIN_HEADER
(*FT_SFNT_TableInfoFunc)( FT_Face face,
FT_UInt idx,
FT_ULong *tag,
FT_ULong *offset,
FT_ULong *length );

View File

@ -3397,6 +3397,7 @@
FT_ULong *length )
{
FT_Service_SFNT_Table service;
FT_ULong offset;
if ( !face || !FT_IS_SFNT( face ) )
@ -3406,7 +3407,7 @@
if ( service == NULL )
return FT_Err_Unimplemented_Feature;
return service->table_info( face, table_index, tag, length );
return service->table_info( face, table_index, tag, &offset, length );
}

View File

@ -113,7 +113,7 @@
FT_ULong tag )
{
FT_Stream stream = face->stream;
FT_Error error;
FT_Error error = FT_Err_Ok;
FT_Service_SFNT_Table service;
FT_Bool result = FALSE;
@ -122,15 +122,18 @@
if ( service )
{
FT_ULong offset, size;
FT_UInt i = 0;
FT_ULong tag_i = 0, offset_i, length_i;
for ( i = 0; !error && tag_i != tag ; i++ )
error = service->table_info( face, i,
&tag_i, &offset_i, &length_i );
error = service->table_info( face, tag, &offset, &size );
if ( error ||
FT_STREAM_SEEK( offset ) )
FT_STREAM_SEEK( offset_i ) )
goto Exit;
result = _tt_check_patents_in_range( stream, size );
result = _tt_check_patents_in_range( stream, length_i );
}
Exit:

View File

@ -104,15 +104,17 @@
sfnt_table_info( TT_Face face,
FT_UInt idx,
FT_ULong *tag,
FT_ULong *offset,
FT_ULong *length )
{
if ( !tag || !length )
if ( !tag || !offset || !length )
return SFNT_Err_Invalid_Argument;
if ( idx >= face->num_tables )
return SFNT_Err_Table_Missing;
*tag = face->dir_tables[idx].Tag;
*offset = face->dir_tables[idx].Offset;
*length = face->dir_tables[idx].Length;
return SFNT_Err_Ok;