chinedufn / psd

A Rust API for parsing and working with PSD files.
https://chinedufn.github.io/psd
Apache License 2.0
265 stars 40 forks source link

Fix crash when loading files with RleCompressed 0-length channels #32

Closed lahickey closed 2 years ago

lahickey commented 2 years ago

When exporting a PSD with a group from GIMP, it seems to add a layer with empty (0-byte length) channels tagged as RleCompressed. This was crashing the 'read_layer_channels' as it was accessing a 0-length array.

This quick fix spots this 0-length situation and changes the compression type to RawData.

chinedufn commented 2 years ago

Awesome, thanks for the first contribution!

chinedufn commented 2 years ago

Released in psd = "0.3.1" https://crates.io/crates/psd/0.3.1