Skip to content

Commit b97386f

Browse files
authored
1 parent 80a6073 commit b97386f

19 files changed

Lines changed: 2335 additions & 164 deletions

SPECS/hdf5/CVE-2025-2153.patch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 4be883f34d8906bd907dcf0ddb17d47dad5357d3 Mon Sep 17 00:00:00 2001
2+
From: Glenn Song <gsong@hdfgroup.org>
3+
Date: Mon, 8 Sep 2025 17:06:52 -0500
4+
Subject: [PATCH 01/14] Add release text
5+
6+
Upstream patch Reference: https://patch-diff.githubusercontent.com/raw/HDFGroup/hdf5/pull/5795.patch
7+
---
8+
src/H5Ocache.c | 4 ++--
9+
src/H5Omessage.c | 3 +++
10+
2 files changed, 5 insertions(+), 2 deletions(-)
11+
12+
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
13+
index 87f321c..12c30cf 100644
14+
--- a/src/H5Ocache.c
15+
+++ b/src/H5Ocache.c
16+
@@ -1399,8 +1399,8 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t
17+
else {
18+
/* Check for message of unshareable class marked as "shareable"
19+
*/
20+
- if ((flags & H5O_MSG_FLAG_SHAREABLE) && H5O_msg_class_g[id] &&
21+
- !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
22+
+ if (((flags & H5O_MSG_FLAG_SHARED) || (flags & H5O_MSG_FLAG_SHAREABLE)) &&
23+
+ H5O_msg_class_g[id] && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
24+
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL,
25+
"message of unshareable class flagged as shareable");
26+
27+
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
28+
index 7190e46..fb9006c 100644
29+
--- a/src/H5Omessage.c
30+
+++ b/src/H5Omessage.c
31+
@@ -354,6 +354,9 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned m
32+
*/
33+
assert(!(mesg_flags & H5O_MSG_FLAG_DONTSHARE));
34+
35+
+ /* Sanity check to see if the type is not sharable */
36+
+ assert(type->share_flags & H5O_SHARE_IS_SHARABLE);
37+
+
38+
/* Remove the old message from the SOHM index */
39+
/* (It would be more efficient to try to share the message first, then
40+
* delete it (avoiding thrashing the index in the case the ref.
41+
--
42+
2.45.4
43+

SPECS/hdf5/CVE-2025-2310.patch

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 2af87ef880bf562f1607aa7b6559e5c596cc0233 Mon Sep 17 00:00:00 2001
2+
From: Matthew Larson <matthewjlar@gmail.com>
3+
Date: Wed, 24 Sep 2025 15:26:20 -0500
4+
Subject: [PATCH 1/4] Add null-termination check during attr decode
5+
6+
Upstream Patch Reference: https://patch-diff.githubusercontent.com/raw/HDFGroup/hdf5/pull/5872.patch
7+
---
8+
src/H5Oattr.c | 6 ++++++
9+
1 file changed, 6 insertions(+)
10+
11+
diff --git a/hdf5-1.14.6/src/H5Oattr.c b/hdf5-1.14.6/src/H5Oattr.c
12+
index 6d1d237..7bdaef7 100644
13+
--- a/src/H5Oattr.c
14+
+++ b/src/H5Oattr.c
15+
@@ -167,6 +167,11 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u
16+
if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end))
17+
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
18+
UINT16DECODE(p, name_len); /* Including null */
19+
+
20+
+ /* Verify that retrieved name length (including null byte) is valid */
21+
+ if (name_len <= 1)
22+
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "decoded name length is invalid");
23+
+
24+
if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end))
25+
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
26+
UINT16DECODE(p, attr->shared->dt_size);
27+
@@ -190,6 +195,7 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u
28+
*/
29+
if (H5_IS_BUFFER_OVERFLOW(p, name_len, p_end))
30+
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
31+
+
32+
if (NULL == (attr->shared->name = H5MM_strndup((const char *)p, name_len - 1)))
33+
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
34+
35+
--
36+
2.45.4
37+

SPECS/hdf5/CVE-2025-2914.patch

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 54f404b5ad8e63d99e3283646b543b2842a22fd3 Mon Sep 17 00:00:00 2001
2+
From: Binh-Minh <bmribler@hdfgroup.org>
3+
Date: Tue, 12 Aug 2025 20:06:42 -0400
4+
Subject: [PATCH] Refix of the attempts in PR-5209
5+
6+
This PR addresses the root cause of the issue by adding a sanity-check immediately
7+
after reading the file space page size from the file.
8+
9+
The same fuzzer in GH-5376 was used to verify that the assert before the vulnerability
10+
had occurred and that an error indicating a corrupted file space page size replaced it.
11+
12+
Upstream Patch Reference: https://patch-diff.githubusercontent.com/raw/HDFGroup/hdf5/pull/5722.patch
13+
---
14+
src/H5Fsuper.c | 2 ++
15+
src/H5Ofsinfo.c | 3 +++
16+
2 files changed, 5 insertions(+)
17+
18+
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
19+
index d9fe3a7..1c8dc6c 100644
20+
--- a/src/H5Fsuper.c
21+
+++ b/src/H5Fsuper.c
22+
@@ -746,6 +746,8 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, bool initial_read)
23+
if (!(flags & H5O_MSG_FLAG_WAS_UNKNOWN)) {
24+
H5O_fsinfo_t fsinfo; /* File space info message from superblock extension */
25+
26+
+ memset(&fsinfo, 0, sizeof(H5O_fsinfo_t));
27+
+
28+
/* f->shared->null_fsm_addr: Whether to drop free-space to the floor */
29+
/* The h5clear tool uses this property to tell the library
30+
* to drop free-space to the floor
31+
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
32+
index 5b69235..2bb6ea6 100644
33+
--- a/src/H5Ofsinfo.c
34+
+++ b/src/H5Ofsinfo.c
35+
@@ -182,6 +182,9 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
36+
if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end))
37+
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
38+
H5F_DECODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */
39+
+ /* Basic sanity check */
40+
+ if (fsinfo->page_size == 0 || fsinfo->page_size > H5F_FILE_SPACE_PAGE_SIZE_MAX)
41+
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid page size in file space info");
42+
43+
if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end))
44+
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
45+
--
46+
2.45.4
47+

SPECS/hdf5/CVE-2025-2924.patch

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 422035e1c0a30f3b363a3994e62ac46f92db9b75 Mon Sep 17 00:00:00 2001
2+
From: Glenn Song <gsong@hdfgroup.org>
3+
Date: Thu, 11 Sep 2025 16:24:33 -0500
4+
Subject: [PATCH 1/4] Add to sanity check
5+
6+
Upstream Patch Reference: https://patch-diff.githubusercontent.com/raw/HDFGroup/hdf5/pull/5814.patch
7+
---
8+
src/H5HLcache.c | 5 +++++
9+
1 file changed, 5 insertions(+)
10+
11+
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
12+
index d0836fe..7f412d2 100644
13+
--- a/src/H5HLcache.c
14+
+++ b/src/H5HLcache.c
15+
@@ -225,6 +225,7 @@ H5HL__fl_deserialize(H5HL_t *heap)
16+
/* check arguments */
17+
assert(heap);
18+
assert(!heap->freelist);
19+
+ HDcompile_assert(sizeof(hsize_t) == sizeof(uint64_t));
20+
21+
/* Build free list */
22+
free_block = heap->free_block;
23+
@@ -232,6 +233,10 @@ H5HL__fl_deserialize(H5HL_t *heap)
24+
const uint8_t *image; /* Pointer into image buffer */
25+
26+
/* Sanity check */
27+
+
28+
+ if (free_block > UINT64_MAX - (2 * heap->sizeof_size))
29+
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "decoded heap block address overflow");
30+
+
31+
if ((free_block + (2 * heap->sizeof_size)) > heap->dblk_size)
32+
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list");
33+
34+
--
35+
2.45.4
36+

SPECS/hdf5/CVE-2025-2925.patch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From c731305ad3717924a9f48d4e4929956e80ce2cb3 Mon Sep 17 00:00:00 2001
2+
From: Glenn Song <gsong@hdfgroup.org>
3+
Date: Thu, 21 Aug 2025 11:36:23 -0500
4+
Subject: [PATCH 01/10] Fix issue5383
5+
6+
Upstream Patch Reference: https://patch-diff.githubusercontent.com/raw/HDFGroup/hdf5/pull/5739.patch
7+
---
8+
src/H5Centry.c | 9 +++++++++
9+
1 file changed, 9 insertions(+)
10+
11+
diff --git a/src/H5Centry.c b/src/H5Centry.c
12+
index 1ca7479..aedcad8 100644
13+
--- a/src/H5Centry.c
14+
+++ b/src/H5Centry.c
15+
@@ -1051,9 +1051,14 @@ H5C__load_entry(H5F_t *f,
16+
*/
17+
do {
18+
if (actual_len != len) {
19+
+ /* Verify that the length isn't a bad value */
20+
+ if (len == 0)
21+
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "len is a bad value");
22+
+
23+
if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE)))
24+
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()");
25+
image = (uint8_t *)new_image;
26+
+
27+
#if H5C_DO_MEMORY_SANITY_CHECKS
28+
H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
29+
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
30+
@@ -1104,6 +1109,10 @@ H5C__load_entry(H5F_t *f,
31+
if (H5C__verify_len_eoa(f, type, addr, &actual_len, true) < 0)
32+
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA");
33+
34+
+ /* Verify that the length isn't 0 */
35+
+ if (actual_len == 0)
36+
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len is a bad value");
37+
+
38+
/* Expand buffer to new size */
39+
if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE)))
40+
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()");
41+
--
42+
2.45.4
43+

SPECS/hdf5/CVE-2025-2926.patch

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From b36c123a68f9f67f5a6de07fcd9caaf8586289c8 Mon Sep 17 00:00:00 2001
2+
From: Binh-Minh <bmribler@hdfgroup.org>
3+
Date: Tue, 16 Sep 2025 11:57:03 -0400
4+
Subject: [PATCH 1/7] Fix CVE-2025-2926, CVE-2025-2913
5+
6+
An image size was corrupted and decoded as 0 resulting in a NULL image buffer,
7+
which caused a NULL pointer dereference when the image being copied to the buffer.
8+
The invalid image size was caught in the PR #5710. This change catches right
9+
before the copying.
10+
11+
Fixes GH issue #5384
12+
Upstream Patch Reference: https://patch-diff.githubusercontent.com/raw/HDFGroup/hdf5/pull/5841.patch
13+
---
14+
src/H5Ocache.c | 1 +
15+
1 file changed, 1 insertion(+)
16+
17+
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
18+
index 12c30cf..4337d6e 100644
19+
--- a/src/H5Ocache.c
20+
+++ b/src/H5Ocache.c
21+
@@ -602,6 +602,7 @@ H5O__cache_chk_get_initial_load_size(void *_udata, size_t *image_len)
22+
assert(udata);
23+
assert(udata->oh);
24+
assert(image_len);
25+
+ assert(udata->size);
26+
27+
/* Set the image length size */
28+
*image_len = udata->size;
29+
--
30+
2.45.4
31+

SPECS/hdf5/CVE-2025-44905.patch

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
From 28ab45329218d9e41bd77929fd3e9cd8a80bd3c7 Mon Sep 17 00:00:00 2001
2+
From: Christian Wojek <christian.wojek@web.de>
3+
Date: Sat, 11 Oct 2025 12:43:06 +0200
4+
Subject: [PATCH 1/5] Fixing CVE-2025-44905. A malformed HDF5 can cause reading
5+
beyond a heap allocation.
6+
7+
Upstream Patch Reference: https://patch-diff.githubusercontent.com/raw/HDFGroup/hdf5/pull/5915.patch
8+
---
9+
src/H5Zscaleoffset.c | 6 ++++++
10+
1 file changed, 6 insertions(+)
11+
12+
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
13+
index 048344b..fbf12d6 100644
14+
--- a/src/H5Zscaleoffset.c
15+
+++ b/src/H5Zscaleoffset.c
16+
@@ -1205,6 +1205,9 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu
17+
unsigned minval_size = 0;
18+
19+
minbits = 0;
20+
+ if (H5_IS_BUFFER_OVERFLOW((unsigned char *)*buf, 5, (unsigned char *)*buf + *buf_size - 1))
21+
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "buffer too short");
22+
+
23+
for (i = 0; i < 4; i++) {
24+
minbits_mask = ((unsigned char *)*buf)[i];
25+
minbits_mask <<= i * 8;
26+
@@ -1220,6 +1223,9 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu
27+
minval_size = sizeof(unsigned long long) <= ((unsigned char *)*buf)[4] ? sizeof(unsigned long long)
28+
: ((unsigned char *)*buf)[4];
29+
minval = 0;
30+
+ if (H5_IS_BUFFER_OVERFLOW((unsigned char *)*buf, 5 + minval_size,
31+
+ (unsigned char *)*buf + *buf_size - 1))
32+
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "buffer too short");
33+
for (i = 0; i < minval_size; i++) {
34+
minval_mask = ((unsigned char *)*buf)[5 + i];
35+
minval_mask <<= i * 8;
36+
--
37+
2.45.4
38+

0 commit comments

Comments
 (0)