mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-09-27 00:30:20 +00:00
hdf5: patch CVE-2026-19025
Backport patch from the PR[1] fixing the issue[2] mentioned in the NVD[3]. [1] https://github.com/HDFGroup/hdf5/pull/6508 [2] https://github.com/HDFGroup/hdf5/issues/6491 [3] https://nvd.nist.gov/vuln/detail/cve-2026-19025 Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
From 0cb26cd769d1da3f2ad2c3836dc1732309f935a7 Mon Sep 17 00:00:00 2001
|
||||
From: Matt L <124107509+mattjala@users.noreply.github.com>
|
||||
Date: Fri, 28 Aug 2026 13:49:02 -0500
|
||||
Subject: [PATCH] Fix CVE-2026-19025 (Reject chunked datasets with mismatched
|
||||
chunk/dspace rank at open time) (#6508)
|
||||
|
||||
* Reject chunked datasets with mismatched chunk/dspace rank
|
||||
|
||||
H5D__chunk_construct() validates that the chunk layout dimensionality
|
||||
matches the dataspace rank, but that runs only at dataset creation time.
|
||||
When an existing dataset is opened, H5D__chunk_init() didn't repeat the
|
||||
check, so a file whose stored chunk rank disagreed with its dataspace rank
|
||||
was accepted. During chunk I/O the memory-selection rank (from the
|
||||
dataspace) and the file-selection rank (chunk ndims - 1) then differ, which
|
||||
produces a zero stride that causes a divide-by-zero in
|
||||
H5S__hyper_iter_get_seq_list().
|
||||
|
||||
H5D__chunk_init() now performs the same dimensionality check on open (the
|
||||
stored chunk rank includes the extra element-size dimension, so it must be
|
||||
exactly one greater than the dataspace rank) and rejects a mismatch with an
|
||||
error.
|
||||
|
||||
Added test_chunk_dims_mismatch() as a regression test in test/dsets.c
|
||||
|
||||
Fixes #6491
|
||||
|
||||
* Fix typo
|
||||
|
||||
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
||||
|
||||
* Clarify element-vs-byte wording
|
||||
|
||||
* Validate chunk/dataspace rank at layout decode time
|
||||
|
||||
Move the stored-chunk-rank vs dataspace-rank consistency check out of
|
||||
H5D__chunk_init() and into H5O__layout_decode(), so a malformed chunked
|
||||
layout is rejected as the message is decoded (mirroring the fill/datatype
|
||||
size check in the fill message decode).
|
||||
|
||||
* Update release_docs/CHANGELOG.md
|
||||
|
||||
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
|
||||
|
||||
* Update CHANGELOG
|
||||
|
||||
* Pin format version bounds in bad chunk layout generator
|
||||
|
||||
---------
|
||||
|
||||
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
||||
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
|
||||
|
||||
CVE: CVE-2026-19025
|
||||
Upstream-Status: Backport [https://github.com/HDFGroup/hdf5/commit/b7b85e7abf9aa9b1dd9693523defa35217684eb2]
|
||||
|
||||
Dropped changes to the test and CHANGELOG file.
|
||||
|
||||
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
|
||||
---
|
||||
src/H5Olayout.c | 32 ++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
|
||||
index d230feb992..5dce35e916 100644
|
||||
--- a/src/H5Olayout.c
|
||||
+++ b/src/H5Olayout.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
+#include "H5Sprivate.h" /* Dataspaces */
|
||||
|
||||
/* Local macros */
|
||||
|
||||
@@ -561,6 +562,37 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
|
||||
}
|
||||
}
|
||||
|
||||
+ /* For a chunked layout, the stored dimensionality includes an extra
|
||||
+ * element-size dimension, so it must be exactly one greater than the
|
||||
+ * dataspace rank. Validate that here
|
||||
+ * to reject malformed files before the inconsistent
|
||||
+ * ranks can cause problems during chunk I/O.
|
||||
+ */
|
||||
+ if (mesg->type == H5D_CHUNKED && open_oh != NULL) {
|
||||
+ htri_t space_exists; /* Whether the dataspace message exists */
|
||||
+
|
||||
+ if ((space_exists = H5O_msg_exists_oh(open_oh, H5O_SDSPACE_ID)) < 0)
|
||||
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't check for dataspace message");
|
||||
+ if (space_exists) {
|
||||
+ H5S_extent_t *extent; /* Dataspace extent from the sibling message */
|
||||
+ int rank; /* Dataspace rank */
|
||||
+
|
||||
+ if (NULL == (extent = (H5S_extent_t *)H5O_msg_read_oh(f, open_oh, H5O_SDSPACE_ID, NULL)))
|
||||
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't read dataspace message");
|
||||
+
|
||||
+ rank = H5S_extent_get_dims(extent, NULL, NULL);
|
||||
+
|
||||
+ /* Done with the sibling dataspace message */
|
||||
+ H5O_msg_free(H5O_SDSPACE_ID, extent);
|
||||
+
|
||||
+ if (rank < 0)
|
||||
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get dataspace rank");
|
||||
+ if (mesg->u.chunk.ndims != (unsigned)rank + 1)
|
||||
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL,
|
||||
+ "dimensionality of chunks doesn't match the dataspace");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Set return value */
|
||||
ret_value = mesg;
|
||||
|
||||
@@ -21,6 +21,7 @@ SRC_URI = "https://support.hdfgroup.org/releases/hdf5/v2_0/v2_0_0/downloads/${BP
|
||||
file://CVE-2026-17572.patch \
|
||||
file://CVE-2026-17573.patch \
|
||||
file://CVE-2026-17574.patch \
|
||||
file://CVE-2026-19025.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "f4c2edc5668fb846627182708dbe1e16c60c467e63177a75b0b9f12c19d7efed"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user