diff options
author | Philipp Lohmann <pl@openoffice.org> | 2002-05-29 07:49:19 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2002-05-29 07:49:19 +0000 |
commit | 2765581397f381cd98abc24bc998b1aec97327ee (patch) | |
tree | f65b817d02b173e7d57ee4242c0744e81cd7c10b /psprint | |
parent | 1d0d67d07db44ca5b4caf00b50e0aa13a86ed076 (diff) |
#99647# #i4468# do not try to read invalid GSUB tables
Diffstat (limited to 'psprint')
-rw-r--r-- | psprint/source/fontsubset/gsub.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/psprint/source/fontsubset/gsub.cxx b/psprint/source/fontsubset/gsub.cxx index 9109ad12b61c..cb5ff86dc7e0 100644 --- a/psprint/source/fontsubset/gsub.cxx +++ b/psprint/source/fontsubset/gsub.cxx @@ -2,9 +2,9 @@ * * $RCSfile: gsub.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: hdu $ $Date: 2001-11-30 12:21:20 $ + * last change: $Author: pl $ $Date: 2002-05-29 08:49:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,11 +101,6 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, unsigned char* pGsubBase, if( !pGsubBase ) return -1; - typedef std::vector<ULONG> ReqFeatureTagList; - ReqFeatureTagList aReqFeatureTagList; - - aReqFeatureTagList.push_back( MKTAG("vert") ); - // parse GSUB header const FT_Byte* pGsubHeader = pGsubBase; const ULONG nVersion = NEXT_Long( pGsubHeader ); @@ -113,6 +108,15 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, unsigned char* pGsubBase, const USHORT nOfsFeatureTable = NEXT_UShort( pGsubHeader ); const USHORT nOfsLookupList = NEXT_UShort( pGsubHeader ); + // sanity check + if( nVersion != 0x00010000 ) + return -1; // unknown format or broken + + typedef std::vector<ULONG> ReqFeatureTagList; + ReqFeatureTagList aReqFeatureTagList; + + aReqFeatureTagList.push_back( MKTAG("vert") ); + typedef std::vector<USHORT> UshortList; UshortList aFeatureIndexList; UshortList aFeatureOffsetList; |