United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4755212 Java2D rasteriser has problems with some TT fonts.
4755212 : Java2D rasteriser has problems with some TT fonts.

Details
Type:
Bug
Submit Date:
2002-09-29
Status:
Resolved
Updated Date:
2003-03-19
Project Name:
JDK
Resolved Date:
2002-10-16
Component:
client-libs
OS:
generic
Sub-Component:
2d
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.1_03

Related Reports
Backport:
Relates:

Sub Tasks

Description
This is one of the causes of bug 
4482430: Unexpected exception from NativeFontWrapper.registerFonts
Two fonts have been identified which each have a pair of problems, which
appear unrelated but either or both can cause a crash.

The fonts have
a) some glyphs with zero or incomplete contours
b) an hmtx table which has more entries than there are glyphs in the font.

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.1_03
mantis

FIXED IN:
1.4.1_03
mantis

INTEGRATED IN:
1.4.1_03
mantis
mantis-b04


                                     
2004-06-14
EVALUATION


1. These fonts appear to have some glyphs with zero or incomplete contours.
The T2k implementation with asserts enabled will trigger an assert
on countourCount ==0 in New_GlyphClass(..)
If asserts are turned off it will SEGV by deferencing a pointer
that hasn't been allocated.
Also if contourCount > 0 but there is only 1 contour and it says that
the final endpoint is point 0 (ep[0]=0, so stmp == 1) then we don't
have a valid contour

The fix is
 - initialise to null some fields that should have been but weren't
 - in the event zero contours return NULL from New_GlyphClass()
 - in the event of the only contour having only 1 pt also return NULL
 - make the caller return an empty glyph instead of asserting on a NULL
   return.

2. The code in New_hmtxClass and *New_hmtxEmptyClass in truetype.c 
   allocates arrays of length numGlyphs, but then reads into this array
   numberOfHMetrics entries. The latter figure is obtained from the hhea
   table. Normally this is OK since numberOfHMetrics is normally not greater
   than numberOfHMetrics but in these fonts it is. This causes random crashes.
   There are supposed to be at least numberOfHMetrics entries, but if that
   value is < numGlyphs its becasue the rest is supposedly an array of LSB.
   So the fix is that if numberOfHMetrics > numGlyphs allocate an array
   big enough to hold it even if we aren't exactly sure where that extra
   data is used.

###@###.### 2002-09-29
============================
                                     
2002-09-29



Hardware and Software, Engineered to Work Together