Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0a57195

Browse files
authored
1 parent 57a2805 commit 0a57195

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

release_docs/RELEASE.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,13 @@ Bug Fixes since HDF5-2.0.0 release
894894

895895
Fixes GitHub issue #4952
896896

897+
- Check for overflow in decoded heap block addresses
898+
899+
Currently, we do not check for overflow when decoding addresses from
900+
the heap, which can cause overflow problems. We've added a check in
901+
H5HL__fl_deserialize to ensure no overflow can occur.
902+
903+
Fixes GitHub issue #5382
897904

898905
Java Library
899906
------------

src/H5HLcache.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,18 @@ H5HL__fl_deserialize(H5HL_t *heap)
225225
/* check arguments */
226226
assert(heap);
227227
assert(!heap->freelist);
228+
HDcompile_assert(sizeof(hsize_t) == sizeof(uint64_t));
228229

229230
/* Build free list */
230231
free_block = heap->free_block;
231232
while (H5HL_FREE_NULL != free_block) {
232233
const uint8_t *image; /* Pointer into image buffer */
233234

234235
/* Sanity check */
236+
237+
if (free_block > UINT64_MAX - (2 * heap->sizeof_size))
238+
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "decoded heap block address overflow");
239+
235240
if ((free_block + (2 * heap->sizeof_size)) > heap->dblk_size)
236241
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list");
237242

0 commit comments

Comments
 (0)