Commit b13d0d5e for libheif
commit b13d0d5eaf2d6cd6c0dfd8f1a18091d36f020759
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Fri Apr 3 14:20:49 2026 +0200
unci: add missing check for components_little_endian()==false when it is not supported
diff --git a/libheif/codecs/uncompressed/unc_decoder.cc b/libheif/codecs/uncompressed/unc_decoder.cc
index 1272e57a..c5fa4ac8 100644
--- a/libheif/codecs/uncompressed/unc_decoder.cc
+++ b/libheif/codecs/uncompressed/unc_decoder.cc
@@ -358,6 +358,14 @@ bool unc_decoder_factory::check_common_requirements(const std::shared_ptr<const
}
+bool unc_decoder_factory::has_any_multi_byte_components(const std::shared_ptr<const Box_uncC>& uncC)
+{
+ const auto& comps = uncC->get_components();
+ return std::any_of(comps.begin(), comps.end(),
+ [](const Box_uncC::Component& c) { return c.component_bit_depth > 8; });
+}
+
+
Error check_hard_limits(const std::shared_ptr<const Box_uncC>& uncC)
{
const auto& components = uncC->get_components();
diff --git a/libheif/codecs/uncompressed/unc_decoder.h b/libheif/codecs/uncompressed/unc_decoder.h
index 895f53ef..3106c6ba 100644
--- a/libheif/codecs/uncompressed/unc_decoder.h
+++ b/libheif/codecs/uncompressed/unc_decoder.h
@@ -98,6 +98,8 @@ public:
protected:
static bool check_common_requirements(const std::shared_ptr<const Box_uncC>& uncC);
+ static bool has_any_multi_byte_components(const std::shared_ptr<const Box_uncC>& uncC);
+
virtual bool can_decode(const std::shared_ptr<const Box_uncC>& uncC) const = 0;
virtual std::unique_ptr<unc_decoder> create(
diff --git a/libheif/codecs/uncompressed/unc_decoder_component_interleave.cc b/libheif/codecs/uncompressed/unc_decoder_component_interleave.cc
index 7faf0244..e57c0714 100644
--- a/libheif/codecs/uncompressed/unc_decoder_component_interleave.cc
+++ b/libheif/codecs/uncompressed/unc_decoder_component_interleave.cc
@@ -158,6 +158,10 @@ bool unc_decoder_factory_component_interleave::can_decode(const std::shared_ptr<
return false;
}
+ if (uncC->is_components_little_endian() && has_any_multi_byte_components(uncC)) {
+ return false;
+ }
+
return true;
}
diff --git a/libheif/codecs/uncompressed/unc_decoder_mixed_interleave.cc b/libheif/codecs/uncompressed/unc_decoder_mixed_interleave.cc
index 81b1e8b2..bcb67501 100644
--- a/libheif/codecs/uncompressed/unc_decoder_mixed_interleave.cc
+++ b/libheif/codecs/uncompressed/unc_decoder_mixed_interleave.cc
@@ -144,6 +144,10 @@ bool unc_decoder_factory_mixed_interleave::can_decode(const std::shared_ptr<cons
return false;
}
+ if (uncC->is_components_little_endian() && has_any_multi_byte_components(uncC)) {
+ return false;
+ }
+
return true;
}
diff --git a/libheif/codecs/uncompressed/unc_decoder_row_interleave.cc b/libheif/codecs/uncompressed/unc_decoder_row_interleave.cc
index 3136209f..f90603c9 100644
--- a/libheif/codecs/uncompressed/unc_decoder_row_interleave.cc
+++ b/libheif/codecs/uncompressed/unc_decoder_row_interleave.cc
@@ -114,6 +114,10 @@ bool unc_decoder_factory_row_interleave::can_decode(const std::shared_ptr<const
return false;
}
+ if (uncC->is_components_little_endian() && has_any_multi_byte_components(uncC)) {
+ return false;
+ }
+
return true;
}