[gimp] Crash workaround for HEIF plug-in



commit dd5cb5cef11750703790d32051141f1ad57c419c
Author: Daniel Novomesky <dnovomesky gmail com>
Date:   Fri Oct 1 20:57:42 2021 +0200

    Crash workaround for HEIF plug-in

 plug-ins/common/file-heif.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c
index 4f569c50ed..2280f41793 100644
--- a/plug-ins/common/file-heif.c
+++ b/plug-ins/common/file-heif.c
@@ -1792,7 +1792,21 @@ save_image (GFile                        *file,
   /* heif_encoder_set_logging_level (encoder, logging_level); */
 
 #if LIBHEIF_HAVE_VERSION(1,8,0)
-  encoder_name = heif_encoder_get_name (encoder);
+  if (compression == heif_compression_HEVC)
+    {
+      /* This is an ugly woraround to avoid following issue:
+       * https://github.com/strukturag/libheif/issues/357
+       * When libheif is built on MSYS2 without CPPFLAGS+=" -DX265_API_IMPORTS=1"
+       * x265_plugin_name called by heif_encoder_get_name can crash.
+       * x265 is only HEVC encoder în libheif so we can avoid the call
+       * and set name by ourselves.
+       */
+      encoder_name = "x265 HEVC encoder";
+    }
+  else
+    {
+      encoder_name = heif_encoder_get_name (encoder);
+    }
 #if LIBHEIF_HAVE_VERSION(1,10,0)
 
   if (lossless && pixel_format != HEIFPLUGIN_EXPORT_FORMAT_RGB)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]