3 ms·
I think the argument would be that if you write a non-standards-compliant unzip utility, in many cases people generating malformed zip files won't get any warni
by x1798DE 10y ago
I think the argument would be that if you write a non-standards-compliant unzip utility, in many cases people generating malformed zip files won't get any warning because the software "knows what you meant to do", then people emitting malformed zip files with a random amount of data at the end won't know that they're doing anything wrong until one day they hit the limit of what is acceptable, way down the road and after they've been emitting malformed zip files for ages.
I think it's the programming equivalent of not telling someone they have some food on their face - yeah, it's no skin off your back if you don't tell them, but who knows who they're going to run into later.
That said, a hybrid approach which fails by default but then offers a way to "force unzip" the file in a non-standards-compliant way might be the best of both worlds here, because the users get an immediate way to fix the problem and the emitters are likely to be notified that they are creating malformed zips.
- TAForObvReasons 10y agoThe problem is that the ZIP format is not a full-file specification: it permits data before and after the logical extents of the ZIP archive. Among other things, it allows for self-extracting archives by prepending the extractor code. the library in this case is erroneously assuming that the archive spans the entire file.
- jonahrd 10y agoI think you're missing arh68's point. If it's supposed to find the magic number, and by definition the comment is allowed to contain the magic number, then this section of the code should (correctly) diagnose that this is not the magic number, but (incorrect in the current implementation) then continue to search backward for the REAL magic number.
- Drdrdrq 10y agoThe way I understood it magic number is not allowed in the comment.