summaryrefslogtreecommitdiff
path: root/psprint
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2005-09-28 13:27:13 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2005-09-28 13:27:13 +0000
commit60e18d731ac8431518be21b7ac2799ccda00d184 (patch)
tree492b7d505bd79833ca3666d535cdc3aee0ade5ac /psprint
parenta1ce9145c00cc29d834662643d9e69cb86d29ac3 (diff)
INTEGRATION: CWS vcl39 (1.30.50); FILE MERGED
2005/06/09 17:03:56 pl 1.30.50.2: #i49113# sanity checks for cmap table 2005/03/21 17:46:47 pl 1.30.50.1: #i42835# support style names
Diffstat (limited to 'psprint')
-rw-r--r--psprint/source/fontsubset/sft.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/psprint/source/fontsubset/sft.c b/psprint/source/fontsubset/sft.c
index bee151301909..f9bc7786e1d0 100644
--- a/psprint/source/fontsubset/sft.c
+++ b/psprint/source/fontsubset/sft.c
@@ -4,9 +4,9 @@
*
* $RCSfile: sft.c,v $
*
- * $Revision: 1.31 $
+ * $Revision: 1.32 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 16:39:50 $
+ * last change: $Author: hr $ $Date: 2005-09-28 14:27:13 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -1176,10 +1176,11 @@ static void GetNames(TrueTypeFont *t)
}
t->subfamily = NULL;
+ t->usubfamily = NULL;
if ((r = findname(table, n, 1, 0, 0, 2)) != -1)
- t->subfamily = nameExtract(table, nTableSize, r, 0, NULL);
+ t->subfamily = nameExtract(table, nTableSize, r, 0, &t->usubfamily);
if ( ! t->subfamily && (r = findname(table, n, 3, 1, 0x0409, 2)) != -1)
- t->subfamily = nameExtract(table, nTableSize, r, 1, NULL);
+ t->subfamily = nameExtract(table, nTableSize, r, 1, &t->usubfamily);
if ( ! t->subfamily )
{
t->subfamily = strdup("");
@@ -1340,6 +1341,7 @@ static sal_uInt16 getGlyph4(const sal_uInt8 *cmap, sal_uInt16 c) {
static void FindCmap(TrueTypeFont *ttf)
{
sal_uInt8 *table = getTable(ttf, O_cmap);
+ sal_uInt32 table_size = getTableSize(ttf, O_cmap);
sal_uInt16 ncmaps = GetUInt16(table, 2, 1);
int i;
sal_uInt32 ThreeZero = 0; /* MS Symbol */
@@ -1354,10 +1356,18 @@ static void FindCmap(TrueTypeFont *ttf)
sal_uInt32 offset;
sal_uInt16 pID, eID;
+ /* sanity check, cmap entry must lie within table */
+ if( i*8+4 > table_size )
+ break;
+
pID = GetUInt16(table, 4 + i * 8, 1);
eID = GetUInt16(table, 6 + i * 8, 1);
offset = GetUInt32(table, 8 + i * 8, 1);
+ /* sanity check, cmap must lie within file */
+ if( (table - ttf->ptr) + offset > ttf->fsize )
+ continue;
+
/* Unicode tables in Apple fonts */
if (pID == 0) {
ThreeOne = offset; break;
@@ -1834,6 +1844,8 @@ void CloseTTFont(TrueTypeFont *ttf) /*FOLD01*/
if( ttf->ufamily )
free( ttf->ufamily );
free(ttf->subfamily);
+ if( ttf->usubfamily )
+ free( ttf->usubfamily );
free(ttf->tables);
free(ttf->tlens);
free(ttf->kerntables);
@@ -2551,6 +2563,7 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info)
info->family = ttf->family;
info->ufamily = ttf->ufamily;
info->subfamily = ttf->subfamily;
+ info->usubfamily = ttf->usubfamily;
info->psname = ttf->psname;
info->symbolEncoded = (ttf->cmapType == CMAP_MS_Symbol);