BUG 363212: Reading Multilayer EXR Files from blender crashes or doesn't work

Authored by beelzy on May 28 2016, 1:26 PM.



Loading EXR files with multiple layers with colorspaces different from the document colorspace crashes. This doesn't fix all the issues in opening that sample exr file, but at least it will load the layers with the correct colorspaces.

Diff Detail

R37 Krita
Lint Skipped
Unit Tests Skipped
beelzy updated this revision to Diff 4032.May 28 2016, 1:26 PM
beelzy retitled this revision from to BUG 363212: Reading Multilayer EXR Files from blender crashes or doesn't work.
beelzy updated this object.
beelzy edited the test plan for this revision. (Show Details)
beelzy added a reviewer: rempt.
beelzy set the repository for this revision to R37 Krita.
beelzy updated this object.
rempt edited edge metadata.May 28 2016, 2:13 PM

Definitely a good thing and should be pushed, but for this particular bug, I now get an infinite loop in

 * Division by a tiny alpha may result in an overflow of half
 * value. That is why we use safe iterational approach.
while (1) {
    dstPixel.setUnmultiplied(srcPixel.pixel, newAlpha);

    if (dstPixel.checkUnmultipliedColorsConsistent(srcPixel.pixel)) {

    newAlpha += alphaEpsilon<channel_type>();
    alphaWasModified = true;
rempt accepted this revision.May 28 2016, 2:13 PM
rempt edited edge metadata.
This revision is now accepted and ready to land.May 28 2016, 2:13 PM
beelzy updated this revision to Diff 4058.May 30 2016, 9:07 AM
beelzy edited edge metadata.

Found the fix for the loop. There is a check used by the unmultiplyAlpha function that checks the alpha values. Unfortunately, it's only written to consider positive alpha values. I don't know if there are any other checks for alpha or color values like this that assumes the values are > 0, but they didn't come up anywhere else in the sample file in the bug ticket.

aacid closed this revision.Feb 26 2017, 11:13 PM
aacid added a subscriber: aacid.