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

ZipFile.Source.initCEN needlessly reads END header

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • None
    • core-libs

      When ZipFile reads the CEN directory into a byte array, it also reads the 22-byte END (of central directory) header at the end of the file.

      The END record is never read from the byte array so this data is unused. Code reading from the byte array needs to account for the extra length, this complicates all code which needs to determine the end of the CEN in this array.

      Additionally, even if the END header was read, the code would not be correct since there could be Zip64 End of Central Directory records between the last CEN header and the END header.

      Also, the current maximum CEN size limit is off by one, it allows a CEN size that hits the implementation limit since it allows creating a byte array of Integer.MAX_VALUE - 1 while the actual implementation limit is Integer.MAX_VALUE - 2.

            eirbjo Eirik Bjørsnøs
            eirbjo Eirik Bjørsnøs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: