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

Wrong comment in java.base/share/native/libjimage/imageFile.hpp

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • None
    • tools
    • b10
    • generic
    • generic

      The comment in imageFile.hpp around line 206 in imageFile.hpp reads:

      // Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
      // (kind = 4, length = 3), 0x03, 0x35, 0x62.

      This assumes that ATTRIBUTE_OFFSET gets int value 4, while it currently has this enum definition:

          enum {
              ATTRIBUTE_END, // End of attribute stream marker
              ATTRIBUTE_MODULE, // String table offset of module name
              ATTRIBUTE_PARENT, // String table offset of resource path parent
              ATTRIBUTE_BASE, // String table offset of resource path base
              ATTRIBUTE_EXTENSION, // String table offset of resource path extension
              ATTRIBUTE_OFFSET, // Container byte offset of resource
              ATTRIBUTE_COMPRESSED, // In image byte size of the compressed resource
              ATTRIBUTE_UNCOMPRESSED, // In memory byte size of the uncompressed resource
              ATTRIBUTE_COUNT // Number of attribute kinds
          };

      So ATTRIBUTE_OFFSET is actually int value 5, not 4 as alluded to in the comment. ATTRIBUTE_EXTENSION is int value 4.

      Also the ATTRIBUTE_END notes seem confusing. What's meant there, I think, is that lower 3 bits might be non-zero for an ATTRIBUTE_END byte, thus checking for a zero byte is not sufficient.

            sgehwolf Severin Gehwolf
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: