Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix crashing when opening HEIF/AVIF images in YCrBr

Dmitry Kazakov70631e374b03
diff --git a/plugins/impex/heif/HeifImport.cpp b/plugins/impex/heif/HeifImport.cpp
index 890181e4f4..a557acc4a1 100644
--- a/plugins/impex/heif/HeifImport.cpp
+++ b/plugins/impex/heif/HeifImport.cpp
@@ -362,7 +362,12 @@ KisImportExportErrorCode HeifImport::convert(KisDocument *document, QIODevice *i
}
colorModel = GrayAColorModelID.id();
heifChroma = heif_chroma_monochrome;
-
+ } else if (heifModel == heif_colorspace_YCbCr) {
+ // we do not support importing YCrBr spaces directly
+ heifimage = handle.decode_image(heif_colorspace_RGB, heif_chroma_undefined);
+ colorModel = RGBAColorModelID.id();
+ heifModel = heifimage.get_colorspace();
+ heifChroma = heifimage.get_chroma_format();
}
// Get the default profile if we haven't found one up till now.