diff options
| author | Ankur Tyagi <ankur.tyagi85@gmail.com> | 2025-10-29 00:32:47 +1300 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@intel.com> | 2025-10-30 14:43:34 +0800 |
| commit | 80bda1d289b3589cff3c3e0b0a917fb741484084 (patch) | |
| tree | 7d017057b28cc66f267dac6e60a26281afe250e6 /meta-oe/recipes-support | |
| parent | 81c0782d8f07966c7999be522bb41c35634944ee (diff) | |
| download | meta-openembedded-80bda1d289b3589cff3c3e0b0a917fb741484084.tar.gz | |
hdf5: patch CVE-2025-6269, CVE-2025-6270, CVE-2025-6516
As mentioned in the issues [1],[2] and [3], PR[4] addressed several vulnerabilities.
[1] https://github.com/HDFGroup/hdf5/issues/5581#issuecomment-3251977160
[2] https://github.com/HDFGroup/hdf5/issues/5579#issuecomment-2993915196
[3] https://github.com/HDFGroup/hdf5/issues/5580#issuecomment-2993727142
[4] https://github.com/HDFGroup/hdf5/pull/5756
Details:
https://nvd.nist.gov/vuln/detail/CVE-2025-6269
https://nvd.nist.gov/vuln/detail/CVE-2025-6270
https://nvd.nist.gov/vuln/detail/CVE-2025-6516
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'meta-oe/recipes-support')
3 files changed, 319 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/hdf5/files/CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_01.patch b/meta-oe/recipes-support/hdf5/files/CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_01.patch new file mode 100644 index 0000000000..c09ade1c4c --- /dev/null +++ b/meta-oe/recipes-support/hdf5/files/CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_01.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | From ac57aaf0186ba175947d370496934fd399fbc225 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: aled-ua <bugbuster.cc@gmail.com> | ||
| 3 | Date: Wed, 15 Jan 2025 15:02:25 -0600 | ||
| 4 | Subject: [PATCH] Fix vuln OSV-2023-77 (#5210) | ||
| 5 | |||
| 6 | CVE: CVE-2025-6269, CVE-2025-6270, CVE-2025-6516 | ||
| 7 | Upstream-Status: Backport [https://github.com/HDFGroup/hdf5/commit/7f27ba8c3a8483c3d7e5e2cb21fefb2c7563422d] | ||
| 8 | (cherry picked from commit 7f27ba8c3a8483c3d7e5e2cb21fefb2c7563422d) | ||
| 9 | Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> | ||
| 10 | --- | ||
| 11 | src/H5Cimage.c | 13 +++++++++---- | ||
| 12 | 1 file changed, 9 insertions(+), 4 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/src/H5Cimage.c b/src/H5Cimage.c | ||
| 15 | index ec1af787d5..72dc52dafb 100644 | ||
| 16 | --- a/src/H5Cimage.c | ||
| 17 | +++ b/src/H5Cimage.c | ||
| 18 | @@ -118,7 +118,8 @@ do { \ | ||
| 19 | /* Helper routines */ | ||
| 20 | static size_t H5C__cache_image_block_entry_header_size(const H5F_t *f); | ||
| 21 | static size_t H5C__cache_image_block_header_size(const H5F_t *f); | ||
| 22 | -static herr_t H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf); | ||
| 23 | +static herr_t H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf, | ||
| 24 | + size_t buf_size); | ||
| 25 | #ifndef NDEBUG /* only used in assertions */ | ||
| 26 | static herr_t H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint8_t **buf, | ||
| 27 | unsigned entry_num); | ||
| 28 | @@ -299,7 +300,7 @@ H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr) | ||
| 29 | /* needed for sanity checks */ | ||
| 30 | fake_cache_ptr->image_len = cache_ptr->image_len; | ||
| 31 | q = (const uint8_t *)cache_ptr->image_buffer; | ||
| 32 | - status = H5C__decode_cache_image_header(f, fake_cache_ptr, &q); | ||
| 33 | + status = H5C__decode_cache_image_header(f, fake_cache_ptr, &q, cache_ptr->image_len + 1); | ||
| 34 | assert(status >= 0); | ||
| 35 | |||
| 36 | assert(NULL != p); | ||
| 37 | @@ -1269,7 +1270,7 @@ H5C__cache_image_block_header_size(const H5F_t *f) | ||
| 38 | *------------------------------------------------------------------------- | ||
| 39 | */ | ||
| 40 | static herr_t | ||
| 41 | -H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf) | ||
| 42 | +H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf, size_t buf_size) | ||
| 43 | { | ||
| 44 | uint8_t version; | ||
| 45 | uint8_t flags; | ||
| 46 | @@ -1289,6 +1290,10 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t * | ||
| 47 | /* Point to buffer to decode */ | ||
| 48 | p = *buf; | ||
| 49 | |||
| 50 | + /* Ensure buffer has enough data for signature comparison */ | ||
| 51 | + if (H5_IS_BUFFER_OVERFLOW(p, H5C__MDCI_BLOCK_SIGNATURE_LEN, *buf + buf_size - 1)) | ||
| 52 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, FAIL, "Insufficient buffer size for signature"); | ||
| 53 | + | ||
| 54 | /* Check signature */ | ||
| 55 | if (memcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0) | ||
| 56 | HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature"); | ||
| 57 | @@ -2388,7 +2393,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) | ||
| 58 | |||
| 59 | /* Decode metadata cache image header */ | ||
| 60 | p = (uint8_t *)cache_ptr->image_buffer; | ||
| 61 | - if (H5C__decode_cache_image_header(f, cache_ptr, &p) < 0) | ||
| 62 | + if (H5C__decode_cache_image_header(f, cache_ptr, &p, cache_ptr->image_len + 1) < 0) | ||
| 63 | HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "cache image header decode failed"); | ||
| 64 | assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_len); | ||
| 65 | |||
diff --git a/meta-oe/recipes-support/hdf5/files/CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_02.patch b/meta-oe/recipes-support/hdf5/files/CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_02.patch new file mode 100644 index 0000000000..f7324f58c1 --- /dev/null +++ b/meta-oe/recipes-support/hdf5/files/CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_02.patch | |||
| @@ -0,0 +1,252 @@ | |||
| 1 | From 89e3e43aa0f64a3bbd253bef658846d9ff030bdd Mon Sep 17 00:00:00 2001 | ||
| 2 | From: bmribler <39579120+bmribler@users.noreply.github.com> | ||
| 3 | Date: Thu, 25 Sep 2025 22:17:14 -0400 | ||
| 4 | Subject: [PATCH] Fixed CVE-2025-6269 (#5850) | ||
| 5 | |||
| 6 | The GitHub issue #5579 included several security vulnerabilities in function | ||
| 7 | H5C__reconstruct_cache_entry(). | ||
| 8 | |||
| 9 | This PR addressed them by: | ||
| 10 | - adding buffer size argument to the function | ||
| 11 | - adding buffer overflow checks | ||
| 12 | - adding input validations | ||
| 13 | - releasing allocated resource on failure | ||
| 14 | |||
| 15 | These changes addressed the crashes reported. However, there is a skiplist | ||
| 16 | crash during the unwinding process that has to be investigated. | ||
| 17 | |||
| 18 | CVE: CVE-2025-6269, CVE-2025-6270, CVE-2025-6516 | ||
| 19 | Upstream-Status: Backport [https://github.com/HDFGroup/hdf5/commit/3914bb7f7ec7105d8bfbeb3aebd92e867cff5b70] | ||
| 20 | (cherry picked from commit 3914bb7f7ec7105d8bfbeb3aebd92e867cff5b70) | ||
| 21 | Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> | ||
| 22 | --- | ||
| 23 | src/H5Cimage.c | 84 ++++++++++++++++++++++++++++++++++++++------------ | ||
| 24 | src/H5Ocont.c | 5 +-- | ||
| 25 | 2 files changed, 68 insertions(+), 21 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/src/H5Cimage.c b/src/H5Cimage.c | ||
| 28 | index 72dc52dafb..b97be228ed 100644 | ||
| 29 | --- a/src/H5Cimage.c | ||
| 30 | +++ b/src/H5Cimage.c | ||
| 31 | @@ -132,7 +132,8 @@ static void H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_ | ||
| 32 | static herr_t H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr); | ||
| 33 | static herr_t H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr); | ||
| 34 | static herr_t H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr); | ||
| 35 | -static H5C_cache_entry_t *H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf); | ||
| 36 | +static H5C_cache_entry_t *H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t *buf_size, | ||
| 37 | + const uint8_t **buf); | ||
| 38 | static herr_t H5C__write_cache_image_superblock_msg(H5F_t *f, bool create); | ||
| 39 | static herr_t H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr); | ||
| 40 | static herr_t H5C__write_cache_image(H5F_t *f, const H5C_t *cache_ptr); | ||
| 41 | @@ -2377,6 +2378,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) | ||
| 42 | { | ||
| 43 | H5C_cache_entry_t *pf_entry_ptr; /* Pointer to prefetched entry */ | ||
| 44 | H5C_cache_entry_t *parent_ptr; /* Pointer to parent of prefetched entry */ | ||
| 45 | + hsize_t image_len; /* Image length */ | ||
| 46 | const uint8_t *p; /* Pointer into image buffer */ | ||
| 47 | unsigned u, v; /* Local index variable */ | ||
| 48 | herr_t ret_value = SUCCEED; /* Return value */ | ||
| 49 | @@ -2392,10 +2394,11 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) | ||
| 50 | assert(cache_ptr->image_len > 0); | ||
| 51 | |||
| 52 | /* Decode metadata cache image header */ | ||
| 53 | - p = (uint8_t *)cache_ptr->image_buffer; | ||
| 54 | - if (H5C__decode_cache_image_header(f, cache_ptr, &p, cache_ptr->image_len + 1) < 0) | ||
| 55 | + p = (uint8_t *)cache_ptr->image_buffer; | ||
| 56 | + image_len = cache_ptr->image_len; | ||
| 57 | + if (H5C__decode_cache_image_header(f, cache_ptr, &p, image_len + 1) < 0) | ||
| 58 | HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "cache image header decode failed"); | ||
| 59 | - assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_len); | ||
| 60 | + assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < image_len); | ||
| 61 | |||
| 62 | /* The image_data_len and # of entries should be defined now */ | ||
| 63 | assert(cache_ptr->image_data_len > 0); | ||
| 64 | @@ -2407,7 +2410,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) | ||
| 65 | /* Create the prefetched entry described by the ith | ||
| 66 | * entry in cache_ptr->image_entrise. | ||
| 67 | */ | ||
| 68 | - if (NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, &p))) | ||
| 69 | + if (NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, &image_len, &p))) | ||
| 70 | HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "reconstruction of cache entry failed"); | ||
| 71 | |||
| 72 | /* Note that we make no checks on available cache space before | ||
| 73 | @@ -2563,19 +2566,21 @@ done: | ||
| 74 | *------------------------------------------------------------------------- | ||
| 75 | */ | ||
| 76 | static H5C_cache_entry_t * | ||
| 77 | -H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **buf) | ||
| 78 | +H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t *buf_size, const uint8_t **buf) | ||
| 79 | { | ||
| 80 | H5C_cache_entry_t *pf_entry_ptr = NULL; /* Reconstructed cache entry */ | ||
| 81 | uint8_t flags = 0; | ||
| 82 | bool is_dirty = false; | ||
| 83 | + haddr_t eoa; | ||
| 84 | + bool is_fd_parent = false; | ||
| 85 | #ifndef NDEBUG /* only used in assertions */ | ||
| 86 | - bool in_lru = false; | ||
| 87 | - bool is_fd_parent = false; | ||
| 88 | - bool is_fd_child = false; | ||
| 89 | + bool in_lru = false; | ||
| 90 | + bool is_fd_child = false; | ||
| 91 | #endif | ||
| 92 | - const uint8_t *p; | ||
| 93 | bool file_is_rw; | ||
| 94 | - H5C_cache_entry_t *ret_value = NULL; /* Return value */ | ||
| 95 | + const uint8_t *p; | ||
| 96 | + const uint8_t *p_end = *buf + *buf_size - 1; /* Pointer to last valid byte in buffer */ | ||
| 97 | + H5C_cache_entry_t *ret_value = NULL; /* Return value */ | ||
| 98 | |||
| 99 | FUNC_ENTER_PACKAGE | ||
| 100 | |||
| 101 | @@ -2595,9 +2600,15 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b | ||
| 102 | p = *buf; | ||
| 103 | |||
| 104 | /* Decode type id */ | ||
| 105 | + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) | ||
| 106 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 107 | pf_entry_ptr->prefetch_type_id = *p++; | ||
| 108 | + if (pf_entry_ptr->prefetch_type_id < H5AC_BT_ID || pf_entry_ptr->prefetch_type_id >= H5AC_NTYPES) | ||
| 109 | + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "type id is out of valid range"); | ||
| 110 | |||
| 111 | /* Decode flags */ | ||
| 112 | + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) | ||
| 113 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 114 | flags = *p++; | ||
| 115 | if (flags & H5C__MDCI_ENTRY_DIRTY_FLAG) | ||
| 116 | is_dirty = true; | ||
| 117 | @@ -2625,19 +2636,31 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b | ||
| 118 | pf_entry_ptr->is_dirty = (is_dirty && file_is_rw); | ||
| 119 | |||
| 120 | /* Decode ring */ | ||
| 121 | + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) | ||
| 122 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 123 | pf_entry_ptr->ring = *p++; | ||
| 124 | - assert(pf_entry_ptr->ring > (uint8_t)(H5C_RING_UNDEFINED)); | ||
| 125 | - assert(pf_entry_ptr->ring < (uint8_t)(H5C_RING_NTYPES)); | ||
| 126 | + if (pf_entry_ptr->ring >= (uint8_t)(H5C_RING_NTYPES)) | ||
| 127 | + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "ring is out of valid range"); | ||
| 128 | |||
| 129 | /* Decode age */ | ||
| 130 | + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) | ||
| 131 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 132 | pf_entry_ptr->age = *p++; | ||
| 133 | + if (pf_entry_ptr->age > H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX) | ||
| 134 | + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "entry age is out of policy range"); | ||
| 135 | |||
| 136 | /* Decode dependency child count */ | ||
| 137 | + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) | ||
| 138 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 139 | UINT16DECODE(p, pf_entry_ptr->fd_child_count); | ||
| 140 | - assert((is_fd_parent && pf_entry_ptr->fd_child_count > 0) || | ||
| 141 | - (!is_fd_parent && pf_entry_ptr->fd_child_count == 0)); | ||
| 142 | + if (is_fd_parent && pf_entry_ptr->fd_child_count <= 0) | ||
| 143 | + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "parent entry has no children"); | ||
| 144 | + else if (!is_fd_parent && pf_entry_ptr->fd_child_count != 0) | ||
| 145 | + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "non-parent entry has children"); | ||
| 146 | |||
| 147 | /* Decode dirty dependency child count */ | ||
| 148 | + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) | ||
| 149 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 150 | UINT16DECODE(p, pf_entry_ptr->fd_dirty_child_count); | ||
| 151 | if (!file_is_rw) | ||
| 152 | pf_entry_ptr->fd_dirty_child_count = 0; | ||
| 153 | @@ -2645,20 +2668,32 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b | ||
| 154 | HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid dirty flush dependency child count"); | ||
| 155 | |||
| 156 | /* Decode dependency parent count */ | ||
| 157 | + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) | ||
| 158 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 159 | UINT16DECODE(p, pf_entry_ptr->fd_parent_count); | ||
| 160 | assert((is_fd_child && pf_entry_ptr->fd_parent_count > 0) || | ||
| 161 | (!is_fd_child && pf_entry_ptr->fd_parent_count == 0)); | ||
| 162 | |||
| 163 | /* Decode index in LRU */ | ||
| 164 | + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) | ||
| 165 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 166 | INT32DECODE(p, pf_entry_ptr->lru_rank); | ||
| 167 | assert((in_lru && pf_entry_ptr->lru_rank >= 0) || (!in_lru && pf_entry_ptr->lru_rank == -1)); | ||
| 168 | |||
| 169 | /* Decode entry offset */ | ||
| 170 | + if (H5_IS_BUFFER_OVERFLOW(p, H5F_SIZEOF_ADDR(f), p_end)) | ||
| 171 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 172 | H5F_addr_decode(f, &p, &pf_entry_ptr->addr); | ||
| 173 | - if (!H5_addr_defined(pf_entry_ptr->addr)) | ||
| 174 | - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry offset"); | ||
| 175 | + | ||
| 176 | + /* Validate address range */ | ||
| 177 | + eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT); | ||
| 178 | + if (!H5_addr_defined(pf_entry_ptr->addr) || H5_addr_overflow(pf_entry_ptr->addr, pf_entry_ptr->size) || | ||
| 179 | + H5_addr_ge(pf_entry_ptr->addr + pf_entry_ptr->size, eoa)) | ||
| 180 | + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry address range"); | ||
| 181 | |||
| 182 | /* Decode entry length */ | ||
| 183 | + if (H5_IS_BUFFER_OVERFLOW(p, H5F_SIZEOF_SIZE(f), p_end)) | ||
| 184 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 185 | H5F_DECODE_LENGTH(f, p, pf_entry_ptr->size); | ||
| 186 | if (pf_entry_ptr->size == 0) | ||
| 187 | HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry size"); | ||
| 188 | @@ -2679,6 +2714,9 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b | ||
| 189 | "memory allocation failed for fd parent addrs buffer"); | ||
| 190 | |||
| 191 | for (u = 0; u < pf_entry_ptr->fd_parent_count; u++) { | ||
| 192 | + | ||
| 193 | + if (H5_IS_BUFFER_OVERFLOW(p, H5F_SIZEOF_ADDR(f), p_end)) | ||
| 194 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 195 | H5F_addr_decode(f, &p, &(pf_entry_ptr->fd_parent_addrs[u])); | ||
| 196 | if (!H5_addr_defined(pf_entry_ptr->fd_parent_addrs[u])) | ||
| 197 | HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid flush dependency parent offset"); | ||
| 198 | @@ -2694,6 +2732,8 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b | ||
| 199 | #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ | ||
| 200 | |||
| 201 | /* Copy the entry image from the cache image block */ | ||
| 202 | + if (H5_IS_BUFFER_OVERFLOW(p, pf_entry_ptr->size, p_end)) | ||
| 203 | + HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 204 | H5MM_memcpy(pf_entry_ptr->image_ptr, p, pf_entry_ptr->size); | ||
| 205 | p += pf_entry_ptr->size; | ||
| 206 | |||
| 207 | @@ -2708,14 +2748,20 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b | ||
| 208 | /* Sanity checks */ | ||
| 209 | assert(pf_entry_ptr->size > 0 && pf_entry_ptr->size < H5C_MAX_ENTRY_SIZE); | ||
| 210 | |||
| 211 | - /* Update buffer pointer */ | ||
| 212 | + /* Update buffer pointer and buffer len */ | ||
| 213 | + *buf_size -= (hsize_t)(p - *buf); | ||
| 214 | *buf = p; | ||
| 215 | |||
| 216 | ret_value = pf_entry_ptr; | ||
| 217 | |||
| 218 | done: | ||
| 219 | - if (NULL == ret_value && pf_entry_ptr) | ||
| 220 | + if (NULL == ret_value && pf_entry_ptr) { | ||
| 221 | + if (pf_entry_ptr->image_ptr) | ||
| 222 | + H5MM_xfree(pf_entry_ptr->image_ptr); | ||
| 223 | + if (pf_entry_ptr->fd_parent_count > 0 && pf_entry_ptr->fd_parent_addrs) | ||
| 224 | + H5MM_xfree(pf_entry_ptr->fd_parent_addrs); | ||
| 225 | pf_entry_ptr = H5FL_FREE(H5C_cache_entry_t, pf_entry_ptr); | ||
| 226 | + } | ||
| 227 | |||
| 228 | FUNC_LEAVE_NOAPI(ret_value) | ||
| 229 | } /* H5C__reconstruct_cache_entry() */ | ||
| 230 | diff --git a/src/H5Ocont.c b/src/H5Ocont.c | ||
| 231 | index c03f4dd1e9..4b1840448a 100644 | ||
| 232 | --- a/src/H5Ocont.c | ||
| 233 | +++ b/src/H5Ocont.c | ||
| 234 | @@ -93,6 +93,9 @@ H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE | ||
| 235 | HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed"); | ||
| 236 | |||
| 237 | /* Decode */ | ||
| 238 | + | ||
| 239 | + cont->chunkno = 0; | ||
| 240 | + | ||
| 241 | if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) | ||
| 242 | HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); | ||
| 243 | H5F_addr_decode(f, &p, &(cont->addr)); | ||
| 244 | @@ -103,8 +106,6 @@ H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE | ||
| 245 | if (cont->size == 0) | ||
| 246 | HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid continuation chunk size (0)"); | ||
| 247 | |||
| 248 | - cont->chunkno = 0; | ||
| 249 | - | ||
| 250 | /* Set return value */ | ||
| 251 | ret_value = cont; | ||
| 252 | |||
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 2832c7e851..80828ad30c 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 | |||
| @@ -21,6 +21,8 @@ SRC_URI = " \ | |||
| 21 | file://CVE-2025-2923-CVE-2025-6816-CVE-2025-6856.patch \ | 21 | file://CVE-2025-2923-CVE-2025-6816-CVE-2025-6856.patch \ |
| 22 | file://CVE-2025-2924.patch \ | 22 | file://CVE-2025-2924.patch \ |
| 23 | file://CVE-2025-2925.patch \ | 23 | file://CVE-2025-2925.patch \ |
| 24 | file://CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_01.patch \ | ||
| 25 | file://CVE-2025-6269-CVE-2025-6270-CVE-2025-6516_02.patch \ | ||
| 24 | " | 26 | " |
| 25 | SRC_URI[sha256sum] = "019ac451d9e1cf89c0482ba2a06f07a46166caf23f60fea5ef3c37724a318e03" | 27 | SRC_URI[sha256sum] = "019ac451d9e1cf89c0482ba2a06f07a46166caf23f60fea5ef3c37724a318e03" |
| 26 | 28 | ||
