Skip to content

463079 JPEG-XL: Prevent crashing when opening CMYK(A) files

Rasyuqa A H requested to merge rasyuqaa/krita:rasyuqaa/jxlcmyk into master

Attempt to fix crash on JXL CMYK import. AFAIK, we're still not supporting it yet:

It looks like the crash originated when we try to load a JXL CMYK image, jxl decoder still gives num_color_channels == 3, assigning it to RGBA model in our code and tried to apply the CMYK ICC, thus throws out the segfault crash. This MR attempts to throw out import error instead of crashing the whole Krita. This MR attempts to enable support for both import and export on CMYK JPEG-XL files.

This JXL CMYK detection also can be a foundation for our future works if we're ready to support it. I also personally tried to import using our existing JxlDecoderSetImageOutCallback and setting it to CMYKA color model but still no avail, black K channel is still missing indicating the need for separate buffer for it...

BUG: 463079

Test Plan

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Rasyuqa A H

Merge request reports