From: "Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco)" <devanshp@cisco.com>
To: openembedded-devel@lists.openembedded.org
Cc: xe-linux-external@cisco.com
Subject: [meta-oe][scarthgap][PATCH 2/2] hdf5: Fix CVE-2026-26197
Date: Fri, 14 Aug 2026 08:21:15 -0700 [thread overview]
Message-ID: <20260814152115.3812730-2-devanshp@cisco.com> (raw)
In-Reply-To: <20260814152115.3812730-1-devanshp@cisco.com>
From: Devansh Patel <devanshp@cisco.com>
This patch backports the upstream fix first released in HDF5 2.1.0.
The upstream fix commit is referenced in [1], and the public advisory
is referenced in [2].
Although the advisory [2] lists HDF5 2.0.0 as affected, NVD [3]
also marks versions before 2.0.0 as affected, and its CPE
configuration marks versions before 2.1.0 as vulnerable. Scarthgap's
HDF5 1.14.4-3 H5T_ARRAY decoder in src/H5Odtype.c computes the array
element count and decodes the parent datatype without checking for
multiplication overflow or verifying that the stored datatype size
matches the element size multiplied by the element count. The
vulnerable code path is therefore present in 1.14.4-3, so this
backport is applicable.
[1] https://github.com/HDFGroup/hdf5/commit/8cd9f7a7ba6757fbb72e36bbe23e127f8507c8a6
[2] https://github.com/HDFGroup/hdf5/security/advisories/GHSA-gh44-7wpq-622f
[3] https://nvd.nist.gov/vuln/detail/CVE-2026-26197
Signed-off-by: Devansh Patel <devanshp@cisco.com>
---
.../hdf5/files/CVE-2026-26197.patch | 69 +++++++++++++++++++
meta-oe/recipes-support/hdf5/hdf5_1.14.4-3.bb | 1 +
2 files changed, 70 insertions(+)
create mode 100644 meta-oe/recipes-support/hdf5/files/CVE-2026-26197.patch
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 000000000..4df770e93
--- /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 <devanshp@cisco.com>
+---
+ 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 80ab17dd2..7769a3034 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"
--
2.35.6
prev parent reply other threads:[~2026-08-14 15:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 15:21 [meta-oe][scarthgap][PATCH 1/2] hdf5: Fix CVE-2026-26199 Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco)
2026-08-14 15:21 ` Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260814152115.3812730-2-devanshp@cisco.com \
--to=devanshp@cisco.com \
--cc=openembedded-devel@lists.openembedded.org \
--cc=xe-linux-external@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.