From 9477ef2b9bf2f9248dead4773dbafad08f23bd75 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 8 Oct 2009 11:16:04 +0000 Subject: [PATCH] (read_cmap_table): Fix bug of handling seg->idDelta. (OTF_close): Free app_data before free all memories. --- src/otfopen.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/otfopen.c b/src/otfopen.c index 6f137df..aacbc30 100644 --- a/src/otfopen.c +++ b/src/otfopen.c @@ -852,7 +852,7 @@ read_cmap_table (OTF *otf, OTF_TableInfo *table, enum OTF_ReaderFlag flag) if (seg->idRangeOffset == 0xFFFF) for (c = seg->startCount; c <= seg->endCount; c++) { - glyph_id = c + seg->idDelta; + glyph_id = (c + seg->idDelta) % 0x10000; cmap->unicode_table[c] = glyph_id; if (glyph_id > max_glyph_id) max_glyph_id = glyph_id; @@ -3026,6 +3026,10 @@ OTF_close (OTF *otf) if (internal_data->table_info[i].stream) free_stream (internal_data->table_info[i].stream); + for (; app_data; app_data = app_data->next) + if (app_data->data && app_data->freer) + app_data->freer (app_data->data); + while (memrec) { OTF_MemoryRecord *next = memrec->next; @@ -3036,9 +3040,6 @@ OTF_close (OTF *otf) memrec = next; } - for (; app_data; app_data = app_data->next) - if (app_data->data && app_data->freer) - app_data->freer (app_data->data); free (internal_data); } if (otf->filename) -- 1.7.10.4