Skip to content

archive/zip: don't read directories containing file data #54801

@neild

Description

@neild

The archive/zip package forbids writing data to directory files: Writing to the io.Writer returned by w.Create("dir/") fails with zip: write to directory.

However, archive/zip permits reading data from directory files. This means there are zip archives that can be read by archive/zip, but not rewritten. In addition, the zip specification doesn't permit directories to contain file data, so these archives are invalid:

Zero-byte files, directories, and other file types that contain no content MUST NOT include file data.

We should return an error when parsing a zip file that contains a directory that contains data.

Thanks to Adam Korczynski (ADA Logics) and OSS-Fuzz for the report.

Metadata

Metadata

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.okay-after-rc1Used by release team to mark a release-blocker issue as okay to resolve either before or after rc1release-blocker

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions