Commit 2a5e0701 for libheif

commit 2a5e070133a27d2ba1fb117e51f28ba0273a8a0d
Author: Dirk Farin <dirk.farin@gmail.com>
Date:   Fri May 15 01:20:44 2026 +0200

    Skip destination-missing channels in copy_image_to instead of dereferencing null

diff --git a/libheif/image/pixelimage.cc b/libheif/image/pixelimage.cc
index 31d86906..5f1cdbb9 100644
--- a/libheif/image/pixelimage.cc
+++ b/libheif/image/pixelimage.cc
@@ -1069,6 +1069,13 @@ Error HeifPixelImage::copy_image_to(const std::shared_ptr<const HeifPixelImage>&

   for (heif_channel channel : channels) {

+    // The source channel set may contain channels that this image does not
+    // have. get_channel_memory() would return nullptr for those, so skip them
+    // instead of dereferencing a null pointer.
+    if (!has_channel(channel)) {
+      continue;
+    }
+
     size_t tile_stride;
     const uint8_t* tile_data = source->get_channel_memory(channel, &tile_stride);