summaryrefslogtreecommitdiffstats
path: root/src/H5HL.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-08-22 06:36:20 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-08-30 15:26:19 (GMT)
commitf6c94f3ba60d071ce1ba8b731a66e47fbc39c095 (patch)
tree85abe26d8eeaf8b8e75b8c5a0dc79c77008fcb15 /src/H5HL.c
parent56f532b1c6263035e38fc9b4845a0b312f9b0f9a (diff)
downloadhdf5-f6c94f3ba60d071ce1ba8b731a66e47fbc39c095.zip
hdf5-f6c94f3ba60d071ce1ba8b731a66e47fbc39c095.tar.gz
hdf5-f6c94f3ba60d071ce1ba8b731a66e47fbc39c095.tar.bz2
Fix for HDFFV-10216 segfault in H5G_node_cmp3 with corrupt h5 file
Fix H5HL_offset_into() to return error when offset exceeds heap data block size. Also fix other places that call this routine to detect error return.
Diffstat (limited to 'src/H5HL.c')
-rw-r--r--src/H5HL.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index fa577c3..dd756f5 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -400,18 +400,20 @@ END_FUNC(PRIV) /* end H5HL_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR,
-void *, NULL, -,
+BEGIN_FUNC(PRIV, ERR,
+void *, NULL, NULL,
H5HL_offset_into(const H5HL_t *heap, size_t offset))
/* Sanity check */
HDassert(heap);
- HDassert(offset < heap->dblk_size);
+ if(offset >= heap->dblk_size)
+ H5E_THROW(H5E_CANTGET, "unable to offset into local heap data block");
ret_value = heap->dblk_image + offset;
+CATCH
+ /* No special processing on errors */
END_FUNC(PRIV) /* end H5HL_offset_into() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_unprotect