rayrobdod / png-inflate

A clean filter for git that decompresses png images
Apache License 2.0
2 stars 0 forks source link

chunks longer than 2^31 bytes #6

Open rayrobdod opened 1 year ago

rayrobdod commented 1 year ago

Although encoders and decoders should treat the length as unsigned, its value shall not exceed 231-1 bytes.

-- the PNG spec (Second Edition)

Also, might want to be able to integration-test this without having to commit a 2MB file into the source repository. Which would mean having to let the derive crate generate files in addition to listing existing paths.

rayrobdod commented 1 year ago

On the one hand, I want the program to be relatively strict in order to avoid corrupting something that it does not understand; on the other hand "be liberal in what you accept"

If the input isn't checked for the artificial chunk size limit, only output, then the test for a large uncompressed file hits the same code paths as a zip bomb, meaning I wouldn't have to do both.

Granted, I don't think CI would be happy whether the program tried to process a large input file or a zip bomb.