diff --git a/meta-oe/recipes-support/hdf5/files/CVE-2026-26197.patch b/meta-oe/recipes-support/hdf5/files/CVE-2026-26197.patch new file mode 100644 index 0000000000..4df770e933 --- /dev/null +++ b/meta-oe/recipes-support/hdf5/files/CVE-2026-26197.patch @@ -0,0 +1,69 @@ +From 8a69764e016009a0ac949707d84161550dde8af4 Mon Sep 17 00:00:00 2001 +From: bmribler <39579120+bmribler@users.noreply.github.com> +Date: Tue, 3 Feb 2026 16:26:51 -0500 +Subject: [PATCH] Validate datatype size for consistency (#6173) + +User report: +When a file is corrupted such that an array datatype's size, the number of elements, +and the element size are not in agreement, it can trigger an out of bounds read. +(private GH issue: GHSA-gh44-7wpq-622f) +Added a validation to ensure the above are in agreement. + +CVE: CVE-2026-26197 +Upstream-Status: Backport [https://github.com/HDFGroup/hdf5/commit/8cd9f7a7ba6757fbb72e36bbe23e127f8507c8a6] + +Backport Changes: +- Omitted release_docs/CHANGELOG.md because the file does not exist in + HDF5 1.14.4-3 and its HDF5 2.1.0 release context is not applicable. + +(cherry picked from commit 8cd9f7a7ba6757fbb72e36bbe23e127f8507c8a6) +Signed-off-by: Devansh Patel +--- + src/H5Odtype.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/src/H5Odtype.c b/src/H5Odtype.c +index 085ce24cd..2541b001f 100644 +--- a/src/H5Odtype.c ++++ b/src/H5Odtype.c +@@ -783,7 +783,8 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); + break; + +- case H5T_ARRAY: ++ case H5T_ARRAY: { ++ size_t expected_size; /* for validating array datatype size consistency */ + /* + * Array datatypes... + */ +@@ -825,6 +826,22 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t + if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent, skip, p_end) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode array parent type"); + ++ /* Check for multiplication overflow */ ++ if (dt->shared->parent->shared->size > 0 && ++ dt->shared->u.array.nelem > SIZE_MAX / dt->shared->parent->shared->size) ++ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, ++ "array datatype size calculation would overflow"); ++ ++ expected_size = dt->shared->parent->shared->size * dt->shared->u.array.nelem; ++ ++ /* Verify the stored size matches the calculated size */ ++ if (dt->shared->size != expected_size) ++ HGOTO_ERROR( ++ H5E_DATATYPE, H5E_BADVALUE, FAIL, ++ "array datatype size mismatch: expected %zu (element_size=%zu * nelem=%zu), got %zu", ++ expected_size, dt->shared->parent->shared->size, dt->shared->u.array.nelem, ++ dt->shared->size); ++ + /* Check if the parent of this array has a version greater than the + * array itself. */ + H5O_DTYPE_CHECK_VERSION(dt, version, dt->shared->parent->shared->version, ioflags, "array", FAIL) +@@ -838,6 +855,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t + if (dt->shared->parent->shared->force_conv == true) + dt->shared->force_conv = true; + break; ++ } + + case H5T_NO_CLASS: + case H5T_NCLASSES: diff --git a/meta-oe/recipes-support/hdf5/hdf5_1.14.4-3.bb b/meta-oe/recipes-support/hdf5/hdf5_1.14.4-3.bb index 80ab17dd2d..7769a30340 100644 --- a/meta-oe/recipes-support/hdf5/hdf5_1.14.4-3.bb +++ b/meta-oe/recipes-support/hdf5/hdf5_1.14.4-3.bb @@ -31,6 +31,7 @@ SRC_URI = " \ file://CVE-2025-2308.patch \ file://CVE-2025-6857.patch \ file://CVE-2026-26199.patch \ + file://CVE-2026-26197.patch \ " SRC_URI[sha256sum] = "019ac451d9e1cf89c0482ba2a06f07a46166caf23f60fea5ef3c37724a318e03"