From 8533bb985e6af2b656d7c45620d8f11f36330b85 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 18 May 2009 06:00:12 -0400 Subject: [PATCH] [GSUB] Protect against mismatching Extension subtable types --- src/hb-ot-layout-gsub-private.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-layout-gsub-private.h b/src/hb-ot-layout-gsub-private.h index da31a704..dc28df6b 100644 --- a/src/hb-ot-layout-gsub-private.h +++ b/src/hb-ot-layout-gsub-private.h @@ -679,10 +679,13 @@ struct SubstLookup : Lookup { unsigned int type = get_type (); if (HB_UNLIKELY (type == GSUB_Extension)) { - /* Return lookup type of first extension subtable. - * The spec says all of them should have the same type. - * XXX check for that in sanitize() */ + unsigned int count = get_subtable_count (); type = get_subtable(0).u.extension->get_type (); + /* The spec says all subtables should have the same type. + * This is specially important if one has a reverse type! */ + for (unsigned int i = 1; i < count; i++) + if (get_subtable(i).u.extension->get_type () != type) + return 0; } return type; -- GitLab