Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.89k stars 323 forks source link

Segfault on unusual ColorMatrix #5496

Open Beep6581 opened 5 years ago

Beep6581 commented 5 years ago

1.

   exiftool -overwrite_original -EXIF:ColorMatrix2='1 0 0 1 0 0 1 0 0' foo.dng
  1. Open foo.dng.
  2. Color Management > Input profile > Camera standard, segfault.

Test images: http://rawtherapee.com/shared/test_images/sony_ilce_7m2_cc24_daylight_software-adobedngconverter.dng http://rawtherapee.com/shared/test_images/sony_ilce_7m2_cc24_daylight_software-empty.dng

Reproducing this bug depends on the Software Exif tag's value not beginning with Adobe DNG Converter, otherwise the embedded ColorMatrix2 is ignored and there is no crash.

Furthermore, if the input profile is set to "Auto-matched camera profile", then the main preview is all black. While the tooltip for "Camera standard" clearly says that RawTherapee will use the matrix embedded in the DNG if one exists, the "Auto-matched camera profile" option makes no mention of using an embedded matrix, so why does ColorMatrix2 affect the preview in that case?

Related to #5490

Entropy512 commented 4 years ago

As to the use of ColorMatrix2 when it shouldn't be getting used - I don't know what's going on there.

As to the crash - looks like the matrix inversion code isn't able to recognize a non-invertable matrix and error out before attempting to do something that is impossible.