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

jimage fails with IAE when attempts to inspect an empty file

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        In case when an empty file is specified instead of image, jimage fails with the following error message:

        % jimage info empty_file

        java.lang.IllegalArgumentException: newLimit > capacity: (28 > 4)
                at java.base/java.nio.Buffer.createLimitException(Buffer.java:367)
                at java.base/java.nio.Buffer.limit(Buffer.java:341)
                at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:1094)
                at java.base/java.nio.MappedByteBuffer.limit(MappedByteBuffer.java:230)
                at java.base/java.nio.MappedByteBuffer.limit(MappedByteBuffer.java:66)
                at java.base/jdk.internal.jimage.BasicImageReader.slice(BasicImageReader.java:203)
                at java.base/jdk.internal.jimage.BasicImageReader.intBuffer(BasicImageReader.java:210)
                at java.base/jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:147)
                at java.base/jdk.internal.jimage.BasicImageReader.open(BasicImageReader.java:173)
                at jdk.jlink/jdk.tools.jimage.JImageTask.iterate(JImageTask.java:383)
                at jdk.jlink/jdk.tools.jimage.JImageTask.run(JImageTask.java:435)
                at jdk.jlink/jdk.tools.jimage.JImageTask.run(JImageTask.java:228)
                at jdk.jlink/jdk.tools.jimage.Main.main(Main.java:34)

        The issue affects all jimage commands.

        Tested on the latest jigsaw and jdk 9-ea+144.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dkononenko Denis Kononenko
                  Reporter:
                  dkononenko Denis Kononenko
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: