From 59b34045097e5e57ecb1d6293c015c80d8553d56 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 6 May 2004 07:07:48 +0000 Subject: [PATCH] (read_name): Argument changed. Set OTF_NameRecord->ascii. If possible, convert Unicode sequence to ASCII. (read_name_table): Adjusted for the change of read_name. (read_cmap_table): Signal an error (not-yet-supported) if format is 2. Support for formats, 8, 10, 12. (read_value_record): Clear value_record at first. (read_lookup_subtable_gpos): Fix for the case subFormat is 1 and 2. (OTF_open): Check file name extension. --- src/otfopen.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/otfopen.c b/src/otfopen.c index e1f9d05..f6a0832 100644 --- a/src/otfopen.c +++ b/src/otfopen.c @@ -2669,7 +2669,15 @@ OTF_open (char *otf_name) void *errret = NULL; OTF *otf; OTF_InternalData *internal_data; - + int len = strlen (otf_name); + const char *ext = otf_name + (len - 4); + + if (len < 4 + || ext[0] != '.' + || (ext[1] != 'O' && ext[1] != 'T' && ext[1] != 'o' && ext[1] != 't') + || (ext[2] != 'T' && ext[2] != 't') + || (ext[3] != 'F' && ext[3] != 'f')) + OTF_ERROR (OTF_ERROR_FILE, otf_name); fp = fopen (otf_name, "r"); if (! fp) OTF_ERROR (OTF_ERROR_FILE, otf_name); -- 1.7.10.4