diff options
author | hdu <duerr@sun.com> | 2009-12-01 10:37:14 +0100 |
---|---|---|
committer | hdu <duerr@sun.com> | 2009-12-01 10:37:14 +0100 |
commit | 8e1696a1e3402f66342d590733a9afdbe4ea840b (patch) | |
tree | 987b31b590d4d81714ddb24ebd381805b214d0c7 /vcl/source/fontsubset | |
parent | dc5c1da812d3feecd465cf81506d1bea82b7c6c8 (diff) |
#i106264# prevent ushort-overflow in GSUB.cov2
Diffstat (limited to 'vcl/source/fontsubset')
-rw-r--r-- | vcl/source/fontsubset/gsub.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 600c03194210..a1c3344f3e5a 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -42,6 +42,7 @@ namespace vcl { typedef sal_uInt32 ULONG; +typedef sal_uInt32 UINT32; typedef sal_uInt16 USHORT; typedef sal_uInt8 FT_Byte; @@ -280,13 +281,11 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, return false; for( int i = nCntRange; --i >= 0; ) { - const USHORT nGlyph0 = NEXT_UShort( pCoverage ); - const USHORT nGlyph1 = NEXT_UShort( pCoverage ); - const USHORT nStartCoverageIndex = NEXT_UShort( pCoverage ); - OSL_ENSURE( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch"); - (void)nStartCoverageIndex; - for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( j, 0 ) ); + const UINT32 nGlyph0 = NEXT_UShort( pCoverage ); + const UINT32 nGlyph1 = NEXT_UShort( pCoverage ); + const USHORT nCovIdx = NEXT_UShort( pCoverage ); + for( UINT32 j = nGlyph0; j <= nGlyph1; ++j ) + aSubstVector.push_back( GlyphSubst( static_cast<USHORT>(j + nCovIdx), 0 ) ); } } break; |