Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8074171

Drawing dashed strokes far outside the drawing region crashes the VM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 7u45
    • client-libs
    • 2d
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0_45"

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 64bit
      Microsoft Windows [Version 6.1.7601]


      A DESCRIPTION OF THE PROBLEM :
      Drawing a dashed curved path crashes the VM for some paths. The effect seems to occur, when the path is far away from the current viewport.
      Maybe, it happens too for large visible paths and there is a relation to bug JDK-7018932.

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      The crash didn't happen with jdk 1.2 till jdk 1.6 32bit.
      It happens with jdk 1.6 64bit, jdk 1.7 32bit and jdk 1.7 64 bit

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The VM shouldn't crash when drawing such paths, even if there are not visible. But sometimes it is easier to draw a path, instead computing if its visible.
      ACTUAL -
      VM crashes

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      The VM crashes without any messages. No file like hs_err_pid is written.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.geom.*;


      public class DrawPath extends Frame {

          public static void main(String[] args) {
              DrawPath f = new DrawPath();
              f.setTitle("DrawPath");
              f.setSize(800, 600);
              f.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });
              f.setVisible(true);
          }

          public void paint(Graphics g) {
              Graphics2D g2 = (Graphics2D)g;
              g2.setPaint(Color.black);

              g2.setTransform(new AffineTransform(0.047244094488189, 0.0, 0.0, 0.047244094488189, -499999.9127666141, -2449053.5983398426));
              float width = 21.166666f;
              float[] dash = new float[] {105.83333f, 42.333332f};
              g2.setStroke(new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10f, dash, 0f));

              GeneralPath path = new GeneralPath();
              path.moveTo(79.0, 820.0);
              path.curveTo(79.0, 825.5228474983079, 83.47715250169206, 830.0, 89.0, 830.0);

              g2.draw(path); // VM crashes here

              // second example
              g2.setTransform(new AffineTransform(0.021084586217955, 0.0, 0.0, 0.021084586217955, -10272.248935966334, 63775.10534680487));
              float width2 = 47.428013f;
              float[] dash2 = new float[] {47.428013f, 94.856026f};
              g2.setStroke(new BasicStroke(width2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10f, dash2, 0f));

              GeneralPath path2 = new GeneralPath();
              path2.moveTo(2498336.809355218, -3823971.0652993172);
              path2.curveTo(2563499.0087125357, -3827449.4930072967, 2628845.744564057, -3824401.2248061746, 2693401.1580272634, -3814871.7821678594);

              g2.draw(path2);
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Check paths before drawing

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: