Commit 16252dab for libheif
commit 16252dab748e6a26ff5f4f33a40a1f0d10f396f7
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Fri May 15 18:40:41 2026 +0200
unci: allocate tiles with correct size (#1800)
diff --git a/libheif/codecs/uncompressed/unc_codec.cc b/libheif/codecs/uncompressed/unc_codec.cc
index 62e86138..57891a1c 100644
--- a/libheif/codecs/uncompressed/unc_codec.cc
+++ b/libheif/codecs/uncompressed/unc_codec.cc
@@ -217,6 +217,19 @@ Result<std::shared_ptr<HeifPixelImage>> UncompressedImageCodec::create_image(con
// what makes component IDs stable across the handle and decoded image.
if (properties.source_extra_data) {
img->clone_component_descriptions_from(*properties.source_extra_data);
+
+ // Source descriptions carry the full-ispe plane sizes populated at parse
+ // time. When this call is for a single tile, width/height are smaller, so
+ // recompute the per-plane sizes from the actual target dimensions before
+ // allocate_buffer_for_component() reads desc->width/height.
+ for (const auto& desc_view : img->get_component_descriptions()) {
+ if (!desc_view.has_data_plane) {
+ continue;
+ }
+ ComponentDescription* desc = img->find_component_description(desc_view.component_id);
+ desc->width = channel_width(width, chroma, desc->channel);
+ desc->height = channel_height(height, chroma, desc->channel);
+ }
}
// Remember which components reference which cmpd indices.