From 6b8aa22a8ac19a46416737a6579cfcb77f647f18 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Thu, 3 Apr 2008 15:38:29 +0000 Subject: [PATCH] (uniscribe_check_otf): Sanity check otf_spec. --- src/ChangeLog | 4 ++++ src/w32uniscribe.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 13bf77f34c0..f9cc1294a16 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-04-03 Jason Rumney + + * w32uniscribe.c (uniscribe_check_otf): Sanity check otf_spec. + 2008-04-03 Kenichi Handa * coding.c (CATEGORY_MASK_ANY): Add CATEGORY_MASK_UTF_16_AUTO. diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index fd10b9fc0f7..ed29955efe9 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -564,6 +564,10 @@ int uniscribe_check_otf (font, otf_spec) DWORD table; int i, retval = 0; + /* Check the spec is in the right format. */ + if (!CONSP (otf_spec) || Flength (val) < 3) + return 0; + /* Break otf_spec into its components. */ script = XCAR (otf_spec); rest = XCDR (otf_spec); @@ -609,6 +613,10 @@ int uniscribe_check_otf (font, otf_spec) if (NILP (features[i])) continue; + /* If features is not a cons, this font spec is messed up. */ + if (!CONSP (features[i])) + goto no_support; + /* Read GPOS/GSUB header. */ OTF_INT16_VAL (tbl, 4, &scriptlist_table); OTF_INT16_VAL (tbl, 6, &feature_table); -- 2.39.5