Skip to content

Commit c9110c7

Browse files
committed
Fix vuln OSV-2023-77
1 parent f264298 commit c9110c7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/H5Cimage.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,11 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t *
12871287
/* Point to buffer to decode */
12881288
p = *buf;
12891289

1290+
/* Ensure buffer has enough data for signature comparison */
1291+
if ((size_t)(*buf + H5C__MDCI_BLOCK_SIGNATURE_LEN - p) > cache_ptr->image_len)
1292+
HGOTO_ERROR(H5E_CACHE, H5E_OVERFLOW, FAIL, "Insufficient buffer size for signature");
1293+
1294+
12901295
/* Check signature */
12911296
if (memcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0)
12921297
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature");

0 commit comments

Comments
 (0)