JDK-5089985 : Drawing GeneralPath crashes JVM if antialias is on
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0,5.0u1,6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux,windows_xp
  • CPU: generic,x86
  • Submitted: 2004-08-20
  • Updated: 2005-05-12
  • Resolved: 2004-11-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
1.4.2_09Fixed 6 betaFixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Description
Name: au137807			Date: 08/20/2004



Following code crashes JVM on Solaris, linux and WindowsXP.

-------------Crash.java-------------
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.geom.GeneralPath;

public class Crash {
    public static void main(String args[]) {
        BufferedImage im = new BufferedImage(640, 480,
                                             BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = im.createGraphics();
        g2d.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
                              RenderingHints.VALUE_ANTIALIAS_ON);
        GeneralPath path = new GeneralPath();
        path.moveTo(0, 0);
        path.lineTo(634,25);
        path.lineTo(640,33);
        path.closePath();
        g2d.draw(path);
    }
}
-------------------------------------
Here is the result of the execution on linux:

#java -version
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode)

java Crash

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  SIGSEGV (0xb) at pc=0x4e3966a0, pid=2149, tid=1075277952
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0-rc-b63 mixed mode)
# Problematic frame:
# C  [libdcpr.so+0xb6a0]
#
# An error report file with more information is saved as hs_err_pid2149.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#
Aborted

The same problem can be reproduced with following values:

(634,25) (640,33)
(634,57) (640,65)
(634,89) (640,97)
(634,121) (640,129)
(634,153) (640,161)
(634,185) (640,193)
(634,217) (640,225)
(634,249) (640,257)
(634,281) (640,289)
(634,313) (640,321)
(634,345) (640,353)
(634,377) (640,385)
(634,409) (640,417)
(634,441) (640,449)

See bug 4587651 for more info.

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

Comments
WORK AROUND Name: au137807 Date: 08/20/2004 ======================================================================
28-08-2004

EVALUATION Not for tiger. ###@###.### 2004-08-20 The problem is that we are getting out of the float precision (in the boundary cases described in this CR) and starting to index out of the runs buffer. Finally, we crash in the runCheckForArcAppend method because of that. So, the checking of the coordinates is required before entering to this method. ###@###.### 10/28/04 10:34 GMT
28-10-0004