-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode)
FULL OS VERSION :
Linux speedy 2.6.20.1mjs #3 SMP Mon May 14 11:22:25 CDT 2007 x86_64 x86_64 x86_64 GNU/Linux
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Calling FontMetrics.stringWidth(string) after setting a very large font size (e.g. 32000) causes the Java VM to crash with a SIGSEGV. Interestingly, larger numbers (e.g. 50000) do not cause the crash.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program
EXPECTED VERSUS ACTUAL BEHAVIOR :
Program should print out a number (-53695 on 1.5.0_11).
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attached seperatly
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
public class TestBug extends JFrame {
public TestBug() {
}
public void test() {
Font f=new Font("culfont",Font.PLAIN,30000);
Graphics2D g=(Graphics2D) this.getGraphics();
g.setFont(f);
FontMetrics fm=g.getFontMetrics();
String string="LAKE";
int length=fm.stringWidth(string);
System.out.println("Size: "+length);
}
public static void main(String[] args) {
TestBug tb=new TestBug();
tb.setVisible(true);
tb.test();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Make sure the application doesn't use excessively large font size. This actually demonstrated a bug in my application, but the VM should handle it gracefully.
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode)
FULL OS VERSION :
Linux speedy 2.6.20.1mjs #3 SMP Mon May 14 11:22:25 CDT 2007 x86_64 x86_64 x86_64 GNU/Linux
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Calling FontMetrics.stringWidth(string) after setting a very large font size (e.g. 32000) causes the Java VM to crash with a SIGSEGV. Interestingly, larger numbers (e.g. 50000) do not cause the crash.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program
EXPECTED VERSUS ACTUAL BEHAVIOR :
Program should print out a number (-53695 on 1.5.0_11).
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attached seperatly
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
public class TestBug extends JFrame {
public TestBug() {
}
public void test() {
Font f=new Font("culfont",Font.PLAIN,30000);
Graphics2D g=(Graphics2D) this.getGraphics();
g.setFont(f);
FontMetrics fm=g.getFontMetrics();
String string="LAKE";
int length=fm.stringWidth(string);
System.out.println("Size: "+length);
}
public static void main(String[] args) {
TestBug tb=new TestBug();
tb.setVisible(true);
tb.test();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Make sure the application doesn't use excessively large font size. This actually demonstrated a bug in my application, but the VM should handle it gracefully.
- duplicates
-
JDK-6533413 REGRESSION:JEudlid bean crashes with font sizes 180 and greater
- Closed
- relates to
-
JDK-6313761 FontMetrics.getStringBounds() floating point overflow problems
- Closed