From 7647ea3fc8fd2e7db3de2008759107ad1a14f8cd Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Fri, 28 Feb 2025 15:20:44 +0100 Subject: [PATCH] workaround for gcc compiler bug (#1421) --- libheif/file.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libheif/file.cc b/libheif/file.cc index 39d4795649..8a678bf92a 100644 --- a/libheif/file.cc +++ b/libheif/file.cc @@ -1024,8 +1024,10 @@ Error HeifFile::set_item_data(const std::shared_ptr& item, const uint8 else { // uncompressed data, plain copy - data_array.resize(size); - memcpy(data_array.data(), data, size); + if (size > 0) { // Note: this 'if' is not necessary, but a workaround to a compiler bug (https://github.com/strukturag/libheif/issues/1421) + data_array.resize(size); + memcpy(data_array.data(), data, size); + } } // copy the data into the file, store the pointer to it in an iloc box entry