Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6577988
Votes 0
Synopsis Java process crashes with assertion failed message on TrueType file loading
Category java:classes_2d
Reported Against
Release Fixed 7(b20)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 07-JUL-2007
Description
FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
MS Windows XP Pro Version 2002 Service Pack 2

A DESCRIPTION OF THE PROBLEM :
java.awt.Font.createFont(int fontFormat, InputStream fontStream) causes JVM crash while loading an invalid TrueType font instead of throwing a FontFormatException.

The particular font file, where the problem is reproduced, has embedded bitmaps and its EBSC table is invalid - contains only the first 4 bytes (00  customer  00 00) (a result got during font creation program development).

"Assertion failed" error message appears, pointing to src/share/native/sun/font/t2k/t2kstrm.c, line 91, expression "pos <= t->maxPos".

While in real life it should be a rare occasion (however, something like incompletely downloaded TTF could probably cause that as well), crashing JVM seems to be a really bad result. In particular, it could be considered as a security flaw in the system.

Also, this, of course, gives no information regarding what exactly wrong with the file, while exception could describe that in more detail.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I can send an sample TTF upon request.


REPRODUCIBILITY :
This bug can be reproduced always.
Posted Date : 2007-07-07 23:09:18.0
Work Around
N/A
Evaluation
Part of T2K engine still uses asserts to detect abnormal situations.
We should switch to tsi_Assert that ensures necessary recovery actions.

Note that problem is actually detected when we try to draw sting and 
we can not throw FontFormatException at this point.
Potentially we can make initial validity check more sophisticated and 
throw exception on construction of Font object.
However, this is overhead for every (even valid) font construction
and may be it is not worth it.
Posted Date : 2007-07-09 09:37:54.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang