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

IndexOutOfBoundsException while reading large TIFF file

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b09
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        The standard TIFF plugin for "javax.imageio" throws an exception on a large CMYK tiff file. Reproducer program and image are attached.

        With JDK 11.0.7:

        $ java --version
        openjdk 11.0.7 2020-04-14
        OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
        OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
        $ java ./testImageIO.java
        #### IMAGIO: DEBUGGING #######
        1 Standard GIF image reader
        2 Standard BMP Image Reader
        3 Standard WBMP Image Reader
        4 Standard PNG image reader
        5 Standard JPEG Image Reader
        6 Standard TIFF image reader
        #### END DEBUG: IMAGIO #######
        Read: SUCCESS

        With JDK 11.0.8+:

        $ java -version
        openjdk version "11.0.8" 2020-07-14
        OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
        OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)
        [testimageio@b93e34df603d] 02:12:27 ~/testImageIO [] $
        java ./testImageIO.java
        #### IMAGIO: DEBUGGING #######
        1 Standard TIFF image reader
        2 Standard PNG image reader
        3 Standard GIF image reader
        4 Standard BMP Image Reader
        5 Standard WBMP Image Reader
        6 Standard JPEG Image Reader
        #### END DEBUG: IMAGIO #######
        Read: FAILED
        java.lang.IndexOutOfBoundsException: off < 0 || len < 0 || off + len > b.length!
                at java.desktop/javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:346)
                at java.desktop/com.sun.imageio.plugins.tiff.TIFFIFD.readFieldValue(TIFFIFD.java:326)
                at java.desktop/com.sun.imageio.plugins.tiff.TIFFIFD.initialize(TIFFIFD.java:1088)
                at java.desktop/com.sun.imageio.plugins.tiff.TIFFImageMetadata.initializeFromStream(TIFFImageMetadata.java:88)
                at java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:319)
                at java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:291)
                at java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.prepareRead(TIFFImageReader.java:964)
                at java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1140)
                at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1468)
                at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1315)
                at testImageIO.main(testImageIO.java:23)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:566)
                at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:404)
                at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:179)
                at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:119)

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jdv Jayathirth D V
                Reporter:
                sgehwolf Severin Gehwolf
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: