dropbox / lepton

Lepton is a tool and file format for losslessly compressing JPEGs by an average of 22%.
https://blogs.dropbox.com/tech/2016/07/lepton-image-compression-saving-22-losslessly-from-images-at-15mbs/
Apache License 2.0
5.01k stars 355 forks source link

Fix wild free. #155

Closed lesniewski closed 2 years ago

lesniewski commented 2 years ago

huffdata is initially allocated using aligned_dealloc but can be replaced with data2 which is allocated using custom_calloc. This can cause a wild free when aligned_dealloc(huffdata) is called. Fix by replacing allocation sites with aligned_alloc.

Noticed and fixed a similar problem with hdrdata.

Fixes #154.