RFR: 8328995: launcher can't open jar files where the offset of the manifest is >4GB
Jiangli Zhou
jiangli at openjdk.org
Wed Mar 27 03:22:22 UTC 2024
On Mon, 25 Mar 2024 21:37:03 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:
> This change fixes a zip64 bug in the launcher that is prevent it from reading the manifest of jars where the 'relative offset of local header' field in the central directory entry is >4GB. As described in APPNOTE.TXT 4.5.3, the offset is too large to be stored in the central directory it is stored in a 'Zip64 Extended Information Extra Field'.
src/java.base/share/native/libjli/manifest_info.h line 59:
> 57: #define ZIP64_EXTID 1 // Extra field Zip64 header ID
> 58:
> 59: #define ZIP64_EXTMAXLEN 36 // Maximum Zip64 extra field length
The fields described in APPNOTE-6.3.9.TXT 4.5.3 are total 32 bytes. Any other additional fields in the Zip64 extended information?
Value Size Description
----- ---- -----------
(ZIP64) 0x0001 2 bytes Tag for this "extra" block type
Size 2 bytes Size of this "extra" block
Original
Size 8 bytes Original uncompressed file size
Compressed
Size 8 bytes Size of compressed data
Relative Header
Offset 8 bytes Offset of local header record
Disk Start
Number 4 bytes Number of the disk on which
this file starts
src/java.base/share/native/libjli/manifest_info.h line 146:
> 144: * Macros for getting Extensible Data Fields
> 145: */
> 146: #define ZIPEXT_HDR(b) SH(b, 0) /* Header ID */
How about naming the macros as ZIP64EXT_HDR and ZIP64EXT_SIZ?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18479#discussion_r1540404585
PR Review Comment: https://git.openjdk.org/jdk/pull/18479#discussion_r1540405121
More information about the core-libs-dev
mailing list