Skip to content

Commit 256d104

Browse files
committed
Fix vuln OSV-2024-370
1 parent 966454a commit 256d104

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/H5Ochunk.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx)
158158
HDassert(oh);
159159
HDassert(idx < oh->nchunks);
160160

161+
/* Ensure idx is within bounds */
162+
if (idx >= oh->nchunks)
163+
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "chunk index out of bounds")
164+
161165
/* Check for protecting first chunk */
162166
if (0 == idx) {
163167
/* Create new "fake" chunk proxy for first chunk */

src/H5Ocont.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg)
222222
HDassert(f);
223223
HDassert(mesg);
224224

225+
if (mesg->chunkno >= open_oh->nchunks)
226+
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "chunk number out of bounds")
227+
225228
/* Notify the cache that the chunk has been deleted */
226229
/* (releases the space for the chunk) */
227230
if (H5O__chunk_delete(f, open_oh, mesg->chunkno) < 0)

0 commit comments

Comments
 (0)