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

AffineTransform crash in native code when passed NaN as a parameter of 'scale'

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_31"
      Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

      FULL OS VERSION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      In the following code:

              AffineTransform transform = new AffineTransform();
              transform.translate(0.5 * image.getWidth() - scale * accX, 0.5 * image.getHeight() - scale * accY);
              transform.scale(scale, scale);
              AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
              Graphics2D graphics = staticImage.createGraphics();
              graphics.setBackground(Color.WHITE);
              graphics.clearRect(0, 0, staticImage.getWidth(), staticImage.getHeight());
              graphics.dispose();
              return op.filter(image, staticImage);

      double variable 'scale' sometimes becomes NaN. And 'op.filter' crashes JVM with error in native code:

      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007019abd2, pid=8508, tid=9100
      #
      # JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.31-b07 mixed mode windows-amd64 compressed oops)
      # Problematic frame:
      # C [mlib_image.dll+0x6abd2]
      #
      # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
      #
      # An error report file with more information is saved as:
      # C:\Users\Home\Dropbox\Shared files\IDEAProjects\NeuralNetwork\hs_err_pid8508.log
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      # The crash happened outside the Java Virtual Machine in native code.
      # See problematic frame for where to report the bug.
      #


      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create empty BufferedImage of some size (and imageType = TYPE_BYTE_GRAY) (image1)
      2. Create another BufferedImage with same parameters (image2)
      3. Assign 'double scale = Double.NaN;'
      4. Create AffineTransform for scale with parameters (scale, scale)
      5. Create AffineTransformOp (op) from transform and TYPE_BILINEAR interpolationType
      6. Call 'op.filter(image1, image2);'

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected result: Java exception (or, maybe, silent execution)
      Actual result: crash of JVM
      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007019abd2, pid=8508, tid=9100
      #
      # JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.31-b07 mixed mode windows-amd64 compressed oops)
      # Problematic frame:
      # C [mlib_image.dll+0x6abd2]
      #
      # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
      #
      # An error report file with more information is saved as:
      # C:\Users\Home\Dropbox\Shared files\IDEAProjects\NeuralNetwork\hs_err_pid8508.log
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      # The crash happened outside the Java Virtual Machine in native code.
      # See problematic frame for where to report the bug.
      #


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class BugExample {
          public static void main(String[] args) {
              BufferedImage staticImage = new BufferedImage(224, 224, BufferedImage.TYPE_BYTE_GRAY);
              BufferedImage image = new BufferedImage(224, 224, BufferedImage.TYPE_BYTE_GRAY);

              double scale = Double.NaN;

              AffineTransform transform = new AffineTransform();
              transform.scale(scale, scale);
              AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
              op.filter(image, staticImage);
          }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fmatte Fairoz Matte
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: