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

XMLWordPrintable

      Problem
      -------

      ZIP file processing throws uncaught IllegalArgumentException when handling corrupted UTF-8 sequences in:

      - Entry names (ZipInputStream/JarInputStream)
      - Entry comments (ZipFile/JarFile only)
      - ZIP file comments (ZipFile/JarFile only)

      Root Cause
      -------

      ZipCoder.toStringUTF8() calls StringCoding.newStringUTF8NoRepl() which throws exceptions that are never caught or handled properly.

      Affected Components
      -------

      - ZipInputStream/JarInputStream: Entry names only
      - ZipFile/JarFile: Entry comments and ZIP file comments
      - All Java versions: 8, 11, 17, 21

      Impact
      -------

      - Frequency: Always reproducible with corrupted UTF-8
      - Exception: IllegalArgumentException (uncaught)
      - Workaround: Wrap ZIP operations in try/catch blocks

      Expected Behavior
      -------

      Should handle invalid UTF-8 gracefully without throwing uncaught exceptions.

            Assignee:
            Roland Mesde
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: