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-22 06:36:20 (GMT)
commitb07eb6efd06bbe44562fe6c93e826f40a56c01d2 (patch)
treee757d29d387275cd8fb8351f5148634277bb176d /src/H5HL.c
parenta6d5bf1a86250cc660cd1ed420eeda6940792be5 (diff)
downloadhdf5-b07eb6efd06bbe44562fe6c93e826f40a56c01d2.zip
hdf5-b07eb6efd06bbe44562fe6c93e826f40a56c01d2.tar.gz
hdf5-b07eb6efd06bbe44562fe6c93e826f40a56c01d2.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