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: 4593165
Votes 19
Synopsis Assertion failed message when corrupt font file encountered
Category java:classes_2d
Reported Against 1.3 , 1.3.1 , 1.4.1 , 1.3.1_01 , 1.3.1_05
Release Fixed 1.5(tiger)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 4838130
Submit Date 12-DEC-2001
Description




java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


The error occurs whenever two conditions are present:
1. There is a corrupted/invalid font file in c:\winnt\fonts
2. The DragSource.getDefaultDragSource() method call is invoked

If you do not have a corrupt font file, you probably won't be able to reproduce
the condition. One that was sent to me is called Johnny-b.ttf but I am not
stating that all copies of this font are corrupt or invalid.

Example source code is a modified version of SwingApplication, renamed to
swingapplication.
<java source>
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.dnd.*;

public class swingapplication {
    private static String labelPrefix = "Number of button clicks: ";
    private int numClicks = 0;

    public Component createComponents() {
        final JLabel label = new JLabel(labelPrefix + "0    ");
// The following line causes assertion failure when an invalid font file is present
        DragSource dragSource = DragSource.getDefaultDragSource();
// Normal op from here...
        JButton button = new JButton("I'm a Swing button!");
        button.setMnemonic('i');
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                numClicks++;
                label.setText(labelPrefix + numClicks);
            }
        });
        label.setLabelFor(button);
        /*
         * An easy way to put space between a top-level container
         * and its contents is to put the contents in a JPanel
         * that has an "empty" border.
         */
        JPanel pane = new JPanel();
        pane.setBorder(BorderFactory.createEmptyBorder(
                                        300, //top
                                        300, //left
                                        100, //bottom
                                        300) //right
                                        );
        pane.setLayout(new GridLayout(0, 1));
        pane.add(button);
        pane.add(label);

        return pane;
    }

    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(
//                UIManager.getSystemLookAndFeelClassName());
              UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception e) { }

        //Create the top-level container and add contents to it.
        JFrame frame = new JFrame("swingapplication");
        swingapplication app = new swingapplication();
        Component contents = app.createComponents();
        frame.getContentPane().add(contents, BorderLayout.CENTER);

        //Finish setting up the frame, and show it.
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        frame.pack();
        frame.setVisible(true);
    }
}
</java source>

Error message when run from command line:
Assertion failed: offset < fFileSize, file
..\..\..\..\src\share\native\sun\awt\font\fontmanager\fontobjects\fontObject.cpp
, line 240

If similar code is invoked in an applet, you will see a similar error in
structure to the error message reported in bug # 4474833.

The corrupted font file has done some serious damage to other applications, so I
will not respond to requests for copies except to Sun engineers. Thanks for
respecting my concerns in this regard.
(Review ID: 135656) 
======================================================================




FULL PRODUCT VERSION :
> java -version
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition
(build 1.4.1-rc-b19)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)

FULL OPERATING SYSTEM VERSION :

 customer  Windows 2000 [Version
5.00.2195]




A DESCRIPTION OF THE PROBLEM :
On trying to launch a PARTICULAR Swing-based application through an
executable error, we get the following error ( using java -jar
cmd).

"Assertion failed: offset < fFileSize, file
../../../src/share/native/sun/awt/fon
t/fontmanager/fontobjects/fontObject.cpp,
line 418

abnormal program termination"

The program doesnt
launch.

REGRESSION.  Last worked in version 1.3

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Reproducing the bug:
====================

i) Create a JAR file
anew - I created one for my open source project - jreversepro - located at
www.sourceforge.net using the jar utility.
   Please check out the
latest code available in the CVS repository of
 
http://www.sourceforge.net/projects/jrevpro  ( anonymous access )
and try to run the ant task - makejar.

It will create the JAR file in the
directory lib.


java -jar jreversepro.jar , then we get the error as -


"Assertion failed: offset < fFileSize, file
../../../src/share/native/sun/awt/fon
t/fontmanager/fontobjects/fontObject.cpp,
line 418

abnormal program termination"



EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected Result:
=================
  When I try to launch the
Swingbased UI, I should get the UI correctly.
  Instead I am getting an
error as follows.

"Assertion failed: offset < fFileSize, file
../../../src/share/native/sun/awt/fon
t/fontmanager/fontobjects/fontObject.cpp,
line 418

abnormal program termination"

ERROR MESSAGES/STACK TRACES THAT OCCUR :
"Assertion failed: offset < fFileSize, file
../../../src/share/native/sun/awt/fon
t/fontmanager/fontobjects/fontObject.cpp,
line 418

abnormal program termination"

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Go to http://www.sourceforge.net/projects/jrevpro.
It uses CVS .

Use anonymous access
and
Check out the latest code on the repository on the branch -  dev_1_3_4.

Try to run the task -

'ant makejar' .

( For this you need the ANT utility available at jakarta. customer .org/ant
).

Then after creating the JAR file try to launch by saying -

"java -jar jreversepro.jar".

It should ideally laucnh a swing-based UI. Instead it reports error.



---------- END SOURCE ----------

CUSTOMER WORKAROUND :
No Work around as of now.
Kindly look into this at a high priority.

As
of now managing with cmd.line utility. Unless this bug is resolved, I cant
release that particular product.

Thanks in advance for helping in
this regard.

Cheers.
Karthik.
(Review ID: 164834)
======================================================================
Work Around




There are two work-arounds:
1) Remove the offending font file. The difficulty is in locating it because
invalid fonts do not get displayed when using the Windows NT Explorer. I suggest
that you compare a list of the fonts in Explorer against a list of the font
files obtained by using a DOS window to do a directory listing of all of the
files.

2) Remove the getDefaultDragSource() method call.
======================================================================
Evaluation




Please provide the corrupted font file.

  xxxxx@xxxxx   2002-01-03 
======================================================================




The assertion failure is reproducible on WinNT with 1.3.0-C and
1.3.1-b24. It happens when the DragSource calls
Toolkit.getDesktopProperty() to load the platform-specific default
drag cursors. The same failure can be reproduced with the following
test case:
--------------------------------------------------------------------
public class Test {
    public static void main(String[] args) {
        java.awt.Toolkit.getDefaultToolkit().getDesktopProperty("");
    }
}
--------------------------------------------------------------------
Reassigning to classes_awt for further investigation.

  xxxxx@xxxxx   2002-01-10

======================================================================

The font supplied as a test case for this bug is smashed.
Work in progress on 1.5 removes the code that generates this
asserts and correctly identifies and rejects the bad font.
So I am marking this as commit to fix in JDK 1.5

  xxxxx@xxxxx   2003-03-14
======================================================================

The code that opens the fonts is now written in Java and catches
exceptions on reading bad data, so this no longer occurs


  xxxxx@xxxxx   2003-04-28
=============================
Comments
  
  Include a link with my name & email   

Submitted On 04-JAN-2002
epenak
The corrupted font file is available on the BMC Software, 
Inc ftp site: ftp.bmc.com
Logon as anonymous and use your email address as password.
cd outgoing/bugid4593165
get abadfont.ttf



Submitted On 03-MAY-2002
tomkwong
on my system batang.ttf causes the problem.


Submitted On 15-APR-2003
Kierone
I've the same problem. I've removed batang.ttf and the error 
still occurs. I'd like to start using the web services but my 
current project will only run using 1.2.x and I need to be using 
1.3. In short - I'm stuck. Is there any way I can find out what 
font is causing the problem? I've tried comparing the DOS list 
to the Explorer view with no joy.



PLEASE NOTE: JDK6 is formerly known as Project Mustang