changeset 104091:5ad8c9beecab

(font_parse_xlfd): Check DPI and AVGWIDTH properties more rigidly.
author Kenichi Handa <handa@m17n.org>
date Tue, 28 Jul 2009 02:07:54 +0000
parents 1d6a73f0d113
children e3c595123485
files src/font.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/font.c	Tue Jul 28 02:07:05 2009 +0000
+++ b/src/font.c	Tue Jul 28 02:07:54 2009 +0000
@@ -1139,7 +1139,10 @@
 	    }
 	}
 
-      ASET (font, FONT_DPI_INDEX, INTERN_FIELD (XLFD_RESY_INDEX));
+      val = INTERN_FIELD (XLFD_RESY_INDEX);
+      if (! NILP (val) && ! INTEGERP (val))
+	return -1;
+      ASET (font, FONT_DPI_INDEX, val);
       val = INTERN_FIELD (XLFD_SPACING_INDEX);
       if (! NILP (val))
 	{
@@ -1151,8 +1154,10 @@
       p = f[XLFD_AVGWIDTH_INDEX];
       if (*p == '~')
 	p++;
-      ASET (font, FONT_AVGWIDTH_INDEX,
-	    font_intern_prop (p, f[XLFD_REGISTRY_INDEX] - 1 - p, 0));
+      val = font_intern_prop (p, f[XLFD_REGISTRY_INDEX] - 1 - p, 0);
+      if (! NILP (val) && ! INTEGERP (val))
+	return -1;
+      ASET (font, FONT_AVGWIDTH_INDEX, val);
     }
   else
     {