BasicImageReader getEntryNames() is stateful and cannot be called more than once

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 26
    • Affects Version/s: None
    • Component/s: tools
    • b24

      The code in: src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
      attempts to read the offsets buffer in order to iterate location entries.
      It does this via:

      ------
              int[] attributeOffsets = new int[offsets.capacity()];
              offsets.get(attributeOffsets);
      ------

      However, the `get()` method in `IntBuffer` does a builk read of the data and adjusts the internal position. This means it's impossible to call the method twice on the same reader instance (and especially the singleton system instance).

      This can fairly trivially be fixed to just iterate the offsets directly without the buffer copy.

            Assignee:
            David Beaumont
            Reporter:
            David Beaumont
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: