ref: ac0f4454f7606af0b2284a5f3511432fd96b099d
parent: 4de7787f225172c0ab20ab42530ffa9267d72ca8
author: suzuki toshiya <[email protected]>
date: Wed Sep 25 06:57:17 EDT 2013
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2013-09-25 suzuki toshiya <[email protected]>
+
+ [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 <[email protected]>
Fix Savannah bug #40090.
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -351,7 +351,6 @@
FT_UNUSED( num_params );
FT_UNUSED( params );
- FT_UNUSED( face_index );
FT_TRACE2(( "BDF driver\n" ));
@@ -375,6 +374,19 @@
/* 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;
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -267,7 +267,6 @@
FT_UNUSED( num_params );
FT_UNUSED( params );
- FT_UNUSED( face_index );
FT_TRACE2(( "PCF driver\n" ));
@@ -344,6 +343,18 @@
goto Fail;
#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 */
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -171,7 +171,6 @@
FT_UNUSED( num_params );
FT_UNUSED( params );
- FT_UNUSED( face_index );
FT_UNUSED( stream );