johannesvollmer / exrs

100% Safe Rust OpenEXR file library
Other
149 stars 22 forks source link

This file cannot be opened #202

Closed fursund closed 1 year ago

fursund commented 1 year ago

https://github.com/johannesvollmer/exrs/blob/66a247789004d974043300daf7bfc57c7d52a459/src/compression/mod.rs#L200

We're hitting in issue where channels are mixed between half and float, and it seems it might fail at this particular line of code?

johannesvollmer commented 1 year ago

Hi! Interesting. Can you provide the file? What error exactly to you encounter, a panic?

Mixing the channel types is tested in the library, so I'm pretty confident that mixing the channels is not the cause. I would like to have a look whether anything else might be the problem :)

fursund commented 1 year ago

https://drive.google.com/file/d/1dM0mpZXaMoAAZQCipFC0-7_hQ3t65wSM/view?usp=sharing

johannesvollmer commented 1 year ago

Thanks! I'll have a look :)

fursund commented 1 year ago

Thanks! It worked before miniz introduction in the lib.

johannesvollmer commented 1 year ago

You mean, before using the zune-inflate dependency for decompression (#183)? Or before using miniz-oxide (#162)?

fursund commented 1 year ago

Before miniz-oxide https://github.com/johannesvollmer/exrs/pull/162

johannesvollmer commented 1 year ago

Interesting. Good to know.

johannesvollmer commented 1 year ago

You think the expected byte size is calculated incorrectly? What error does it result in?

fursund commented 1 year ago

Error is: "thread 'main' panicked at 'called Result::unwrap() on an Err value: Invalid("compressed ZIP1 data (invalid: zlib-compressed data malformed)")'". Yeah my guess was that the expected byte size was wrong.

johannesvollmer commented 1 year ago

Thanks for sharing! I'll have a look as soon as I can :)

fursund commented 1 year ago

If I remove ".set_limit(expected_byte_size)" here: https://github.com/johannesvollmer/exrs/blob/66a247789004d974043300daf7bfc57c7d52a459/src/compression/zip.rs#L22 then it works

johannesvollmer commented 1 year ago

some findings:

theory: the data is decompressed to the correct size, but zune-inflate reports an error when a limit is set, even though the limit is set to that exact size of the uncompressed data. the error message limit was 393,... and output size is 392,... shows that the data is smaller than the expected size, but an error is returned nevertheless.

johannesvollmer commented 1 year ago

here's the compressed data blob which results in the error: zlib-compressed-binary 393216 bytes.zip this is it, decompressed: zlib-compressed-binary 393216 bytes decompressed.zip, decompressed.len() = 393216

johannesvollmer commented 1 year ago

asked for help from our friends at zune-inflate

johannesvollmer commented 1 year ago

they fixed it incredibly fast, it's already online! now, be sure to run cargo update and then check if it works :)

fursund commented 1 year ago

great thanks!

johannesvollmer commented 1 year ago

alright, reopen this issue if the problem persists :)

johannesvollmer commented 1 year ago

this file must be added to the repository to detect this problem in the future

johannesvollmer commented 1 year ago

Please respond swiftly if you give the exrs project permission to use this file for testing purposes :) I will include it in the repository in that case

fursund commented 1 year ago

Yes you can use it for testing

johannesvollmer commented 1 year ago

awesome, thanks!