[jdk21u-dev] RFR: 8321156: Improve the handling of invalid UTF-8 byte sequences for ZipInputStream::getNextEntry and ZipFile::getComment

Roland Mesde duke at openjdk.org
Mon Nov 17 20:21:59 UTC 2025


Backporting JDK-8321156: Improve the handling of invalid UTF-8 byte sequences for ZipInputStream::getNextEntry and ZipFile::getComment.

Fixes invalid UTF-8 byte sequence handling in:
- ZIP entry names within LOC file headers
- ZIP file comments accessed through ZipFile::getComment

Behavior change: ZipFile::getComment now returns null when invalid UTF-8 sequences are detected during byte-to-String conversion.

Ran GHA Sanity Checks (passed) and related test (passed).

-------------

Commit messages:
 - Backport 20c71ceacdcb791f5b70cda456bdc47bdd9acf6c

Changes: https://git.openjdk.org/jdk21u-dev/pull/2480/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=2480&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8321156
  Stats: 289 lines in 3 files changed: 176 ins; 16 del; 97 mod
  Patch: https://git.openjdk.org/jdk21u-dev/pull/2480.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/2480/head:pull/2480

PR: https://git.openjdk.org/jdk21u-dev/pull/2480


More information about the jdk-updates-dev mailing list