Closed StefanVK closed 1 year ago
Thanks for pointing this out! Looks like that function ignored the existence of filter bytes...
It should be fixed now, please give it a look!
Thank you for the amazingly quick fix, Luca! This fixes our problem and your explanation why it's correct to add 1*height bytes for the filter byte for each scan line makes sense.
There exist some scenarios for which FPNGEOutputAllocSize underestimates the required size. This can lead to a heap buffer overflows.
So far I only ran into the problem with 1 pixel wide grayvalue images at compression level 2.
Example image 1 channel 1x64000 noise
With added -g option for grayvalue images: ./fpnge -2 -g ../testdata/narrow_gv.png out.png Segmentation fault (core dumped)
Allocated size: 129024 Encoded size: 129875