diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-08-22 06:36:20 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2017-08-22 06:36:20 (GMT) |
commit | b07eb6efd06bbe44562fe6c93e826f40a56c01d2 (patch) | |
tree | e757d29d387275cd8fb8351f5148634277bb176d /src/H5Glink.c | |
parent | a6d5bf1a86250cc660cd1ed420eeda6940792be5 (diff) | |
download | hdf5-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/H5Glink.c')
-rw-r--r-- | src/H5Glink.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/H5Glink.c b/src/H5Glink.c index d246ee7..77b69cb 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -224,7 +224,9 @@ herr_t H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, const char *name) { - FUNC_ENTER_PACKAGE_NOERR + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* check arguments */ HDassert(lnk); @@ -243,7 +245,8 @@ H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, if(ent->type == H5G_CACHED_SLINK) { const char *s; /* Pointer to link value */ - s = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset); + if((s = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset)) == NULL) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") HDassert(s); /* Copy the link value */ @@ -260,7 +263,10 @@ H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, lnk->type = H5L_TYPE_HARD; } /* end else */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + if(ret_value < 0 && lnk->name) + H5MM_xfree(lnk->name); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__ent_to_link() */ |