fhanau / Efficient-Compression-Tool

Fast and effective C++ file optimizer
Apache License 2.0
596 stars 41 forks source link

crash with slightly damaged PNG #104

Closed krishty closed 2 years ago

krishty commented 2 years ago

Optimize the following PNG with ECT using ECT_x64.exe cloud_64.png and it will crash with an access violation.

TweakPNG tells me that there may be garbage at the end of the file; however, this should not crash ECT. cloud_64

fhanau commented 2 years ago

Looks like there is a crash based on how lodepng iterates through chunks in the image. Fortunately, it looks like upstream lodepng does not crash. I am currently working on updating ECT's lodepng, which should resolve this issue, although that will take some more time given the size of the library.

fhanau commented 2 years ago

ECT's lodepng has been updated to the upstream version, it no longer crashes on the provided file. Since this appears to be an uncommon issue I'll try to address a few more things before publishing another release, but please let me know if you encounter any other issues with images that have data beyond the IEND chunk, AFAIK this was never thoroughly tested.