[bdf, pcf] Refuse non-zero face_index.

Suggested by Akira Tagoh, see

  http://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html

* src/bdf/bdfdrivr.c (BDF_Face_Init): Return Invalid_Argument error
when the font could be opened but non-zero face_index is given.
* src/pcf/pcfdrivr.c (PCF_Face_Init): Ditto.

* src/type42/t42objs.c (T42_Face_Init): Remove unrequired FT_UNUSED
macro for face_index because it is validated in later.
This commit is contained in:
suzuki toshiya 2013-09-25 10:57:17 +09:00
parent 4de7787f22
commit ac0f4454f7
4 changed files with 40 additions and 3 deletions

View File

@ -1,3 +1,18 @@
2013-09-25 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[bdf, pcf] Refuse non-zero face_index.
Suggested by Akira Tagoh, see
http://lists.gnu.org/archive/html/freetype/2013-09/msg00030.html
* src/bdf/bdfdrivr.c (BDF_Face_Init): Return Invalid_Argument error
when the font could be opened but non-zero face_index is given.
* src/pcf/pcfdrivr.c (PCF_Face_Init): Ditto.
* src/type42/t42objs.c (T42_Face_Init): Remove unrequired FT_UNUSED
macro for face_index because it is validated in later.
2013-09-23 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #40090.

View File

@ -351,7 +351,6 @@ THE SOFTWARE.
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( face_index );
FT_TRACE2(( "BDF driver\n" ));
@ -375,6 +374,19 @@ THE SOFTWARE.
/* we have a bdf font: let's construct the face object */
face->bdffont = font;
/* BDF could not have multiple face in single font file.
* XXX: non-zero face_index is already invalid argument, but
* Type1, Type42 driver has a convention to return
* an invalid argument error when the font could be
* opened by the specified driver.
*/
if ( face_index > 0 ) {
FT_ERROR(( "BDF_Face_Init: invalid face index\n" ));
BDF_Face_Done( bdfface );
return FT_THROW( Invalid_Argument );
}
{
bdf_property_t* prop = NULL;

View File

@ -267,7 +267,6 @@ THE SOFTWARE.
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( face_index );
FT_TRACE2(( "PCF driver\n" ));
@ -346,6 +345,18 @@ THE SOFTWARE.
#endif
}
/* PCF could not have multiple face in single font file.
* XXX: non-zero face_index is already invalid argument, but
* Type1, Type42 driver has a convention to return
* an invalid argument error when the font could be
* opened by the specified driver.
*/
if ( face_index > 0 ) {
FT_ERROR(( "PCF_Face_Init: invalid face index\n" ));
PCF_Face_Done( pcfface );
return FT_THROW( Invalid_Argument );
}
/* set up charmap */
{
FT_String *charset_registry = face->charset_registry;

View File

@ -171,7 +171,6 @@
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( face_index );
FT_UNUSED( stream );