[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
diff --git a/ChangeLog b/ChangeLog
index 55467c2..8e32d45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index a0ddd28..caa142b 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -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;
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index ac824bd..748cbca 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -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;
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index c1c3e08..f5aa2ca 100644
--- 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 );