Cykooz / libheif-rs

Safe wrapper to libheif-sys for parsing heif/heic files
MIT License
34 stars 11 forks source link

Use after free in HeifContext::read_from_bytes? #13

Closed sophie-h closed 1 year ago

sophie-h commented 1 year ago

I had issues with HeifContext::read_from_bytes and dropping the argument before decoding the image afterward. I think it crashed with segfaulted, but I don't know for sure. It does not happen with every image.

I guess read_from_bytes might need to take ownership of the bytes or a lifetime guarantee.

Maybe the issue is obvious when looking at libheif API. If it's not, I can try to create a reproducer soon. (Currently a bit busy with moving.)

Cykooz commented 1 year ago

Oh, you are right. I will try to fix it.

Cykooz commented 1 year ago

I've released version 0.20 with added lifetime for HeifContext.