Closed ghost closed 7 years ago
Thank you for reporting the issue!
I did quick fix in https://github.com/syoyo/tinyexr/tree/compress-size-check branch.
(The test code is added to test/unit/tester.cc
)
Please take a look at this branch and confirm it works or not.
I rerun my test and looked at the code and it seems fixed; thanks.
Thank you for testing!
Merged into master
.
As I was constructing a simple example for my Haskell library I found that if compressed stream is longer then uncompressed one, the latter has to be stored. In fact, I found a reference to it in spec (http://www.openexr.com/openexrfilelayout.pdf):
The problem can be easily fixed by checking the length of the stream and writing the shorter one (the header still keeps the compression flag).
Here is tweaked example that writes single red pixel, but when viewed in GIMP, it is blue (with ZIPS GIMP reports corrupted file):