On 23/02/2023 16:32, Lance Andersen wrote:
HI Eirik
On Feb 23, 2023, at 7:43 AM, Eirik Bjørsnøs <[email protected]> wrote:
Hi,
While writing various ZIP related tests, I noticed a discrepancy in
the treatment of invalid CRC values:
While ZipInputStream rejects invalid CRC values when consuming
streams, ZipFile and ZipFileSystem do not.
While this is inconsistent, it is perhaps not a bug we want to fix?
I believe it is intentional. Alan, Martin B, do you recall the history?
I think Dave Bristor or Martin looked at this at one point so you might
have to search JBS for issues where they commented on this topic.
As a general point, the ZIP format can have redundant metadata and there
can be cases where the CRC-32 isn't available when writing a LOC header.
At the same time, the APIs work differently in that ZipFile opens a ZIP
file so it has access to the CEN whereas ZipInputStream is working on a
stream of ZIP entries and does not read the CEN. So some
inconsistencies in the handling is not too surprising.
-Alan