Twinside / Juicy.Pixels

Haskell library to load & save pictures
BSD 3-Clause "New" or "Revised" License
238 stars 57 forks source link

Fix doing math in Word32 when Int is wanted and values are >2^32 #217

Closed davean closed 1 year ago

davean commented 1 year ago

The calculation of vector size for PNG decoding used Word32 and then converted it to Int. Combined with the copious use of unsafe functions in PNG decoding this lead to segmentation faults on non-small PNGs.

Doing the calculations in the destination type to begin with solves this and even cleans up the code a bit.