[cff] Allow SIDs >= 65000.

* src/cff/cffload.c (cff_charset_load): Fix change from 2009-03-20:
The threshold for SIDs is not applicable here.  I misinterpreted the
`SID values 65000 and above are available for implementation use'
sentence in the CFF specification.

Problem reported by Ivan Ninčić <inincic@pdftron.com>.
This commit is contained in:
Werner Lemberg 2010-08-29 10:46:26 +02:00
parent 1ab1e9ae30
commit 0e95b3d15c
2 changed files with 21 additions and 31 deletions

View File

@ -1,16 +1,28 @@
2010-08-29 Werner Lemberg <wl@gnu.org>
[cff] Allow SIDs >= 65000.
* src/cff/cffload.c (cff_charset_load): Fix change from 2009-03-20:
The threshold for SIDs is not applicable here. I misinterpreted the
`SID values 65000 and above are available for implementation use'
sentence in the CFF specification.
Problem reported by Ivan Ninčić <inincic@pdftron.com>.
2010-08-28 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2010-08-28 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Force hinting when the font lacks its familyname. Force hinting when the font lacks its familyname.
In Type42 or Type11 font embedded in PostScript & PDF, TrueType
sfnt stream may lack `name' table because they are not required. In Type42 or Type11 font embedded in PostScript & PDF, TrueType sfnt
Hinting for nameless fonts is safer for PDFs including embedded stream may lack `name' table because they are not required. Hinting
Chinese fonts. Written by David Bevan, see: for nameless fonts is safer for PDFs including embedded Chinese
fonts. Written by David Bevan, see:
http://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html http://lists.gnu.org/archive/html/freetype-devel/2010-08/msg00021.html
http://lists.freedesktop.org/archives/poppler/2010-August/006310.html http://lists.freedesktop.org/archives/poppler/2010-August/006310.html
* src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer * src/truetype/ttobjs.c (tt_check_trickyness): If a NULL pointer by
by nameless font is given, TRUE is returned to enable hinting. nameless font is given, TRUE is returned to enable hinting.
2010-08-28 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> 2010-08-28 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>

View File

@ -881,20 +881,7 @@
goto Exit; goto Exit;
for ( j = 1; j < num_glyphs; j++ ) for ( j = 1; j < num_glyphs; j++ )
{ charset->sids[j] = FT_GET_USHORT();
FT_UShort sid = FT_GET_USHORT();
/* this constant is given in the CFF specification */
if ( sid < 65000L )
charset->sids[j] = sid;
else
{
FT_TRACE0(( "cff_charset_load:"
" invalid SID value %d set to zero\n", sid ));
charset->sids[j] = 0;
}
}
FT_FRAME_EXIT(); FT_FRAME_EXIT();
} }
@ -927,20 +914,11 @@
goto Exit; goto Exit;
} }
/* check whether the range contains at least one valid glyph; */
/* the constant is given in the CFF specification */
if ( glyph_sid >= 65000L )
{
FT_ERROR(( "cff_charset_load: invalid SID range\n" ));
error = CFF_Err_Invalid_File_Format;
goto Exit;
}
/* try to rescue some of the SIDs if `nleft' is too large */ /* try to rescue some of the SIDs if `nleft' is too large */
if ( nleft > 65000L - 1L || glyph_sid >= 65000L - nleft ) if ( glyph_sid > 0xFFFFL - nleft )
{ {
FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" )); FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" ));
nleft = ( FT_UInt )( 65000L - 1L - glyph_sid ); nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );
} }
/* Fill in the range of sids -- `nleft + 1' glyphs. */ /* Fill in the range of sids -- `nleft + 1' glyphs. */