Commit 61a620db for libheif
commit 61a620db3ded5bee85c315a87ba49ed4fe8bc05c
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Tue May 19 02:12:14 2026 +0200
unci: limit block size of block_pixel_interleave decoder to 64 bits
diff --git a/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc b/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc
index 64d08026..9ad9b006 100644
--- a/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc
+++ b/libheif/codecs/uncompressed/unc_decoder_block_pixel_interleave.cc
@@ -208,7 +208,11 @@ bool unc_decoder_factory_block_pixel_interleave::can_decode(const std::shared_pt
return false;
}
- if (uncC->get_block_size() > 8) {
+ // The decoder packs each block into a uint64_t, so the effective block size
+ // (block_size, or pixel_size when block_size is 0) must fit in 8 bytes.
+ const uint32_t effective_block_size = uncC->get_block_size() != 0 ? uncC->get_block_size()
+ : uncC->get_pixel_size();
+ if (effective_block_size > 8) {
return false;
}