summaryrefslogtreecommitdiffstats
path: root/src/H5Gstab.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-08-29 17:45:03 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-08-29 17:45:03 (GMT)
commit61bdee1ff77a5db47ce8a88ce7e3c83e58123236 (patch)
treefaf7f3ac42a3f86b3a3fc4ba43a434a0db4f86e6 /src/H5Gstab.c
parentb82ba32275f7ed998aafa68a1cecaab3e80323da (diff)
parent289007567e6ab5e0893af787b1870f27f10644c7 (diff)
downloadhdf5-61bdee1ff77a5db47ce8a88ce7e3c83e58123236.zip
hdf5-61bdee1ff77a5db47ce8a88ce7e3c83e58123236.tar.gz
hdf5-61bdee1ff77a5db47ce8a88ce7e3c83e58123236.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '289007567e6ab5e0893af787b1870f27f10644c7': Add commentary around calling H5Screate_simple with a single element Miscellaneous improvements (cont.) Description: Put back H5Location::getNumObjs and marked as deprecated in favor of Group::getNumObjs. Platforms tested: Linux/32 2.6 (jam) Darwin (osx1010test) Miscellaneous improvements Description: Moved H5Location::getNumObjs to Group::getNumObjs (i.e., H5Gget_info) Switched reinterpret_cast to static_cast in H5Object::iterateAttrs Miscellaneous cleanup Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) Fix for daily test failure Fix for the compilation error from the PGI compiler. Modifications based on comments from pull request review (1) Remove unnecessary asserts (2) Add code to insert bad offset values to the test file in gen_bad_offset.c 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. Fix the t_bigio test so that it runs on 32bit machines
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r--src/H5Gstab.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index a239cfe..4dc06ca 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -707,11 +707,12 @@ done:
static herr_t
H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata)
{
- H5G_bt_it_gnbi_t *udata = (H5G_bt_it_gnbi_t *)_udata;
+ H5G_bt_it_gnbi_t *udata = (H5G_bt_it_gnbi_t *)_udata;
size_t name_off; /* Offset of name in heap */
const char *name; /* Pointer to name string in heap */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_NOAPI_NOINIT
/* Sanity check */
HDassert(ent);
@@ -719,12 +720,15 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata)
/* Get name offset in heap */
name_off = ent->name_off;
- name = (const char *)H5HL_offset_into(udata->heap, name_off);
- HDassert(name);
- udata->name = H5MM_strdup(name);
- HDassert(udata->name);
- FUNC_LEAVE_NOAPI(SUCCEED)
+ if((name = (const char *)H5HL_offset_into(udata->heap, name_off)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name")
+
+ if((udata->name = H5MM_strdup(name)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to duplicate symbol table link name")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_stab_get_name_by_idx_cb */
@@ -941,8 +945,8 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata)
HDassert(udata && udata->heap);
/* Get a pointer to the link name */
- name = (const char *)H5HL_offset_into(udata->heap, ent->name_off);
- HDassert(name);
+ if((name = (const char *)H5HL_offset_into(udata->heap, ent->name_off)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name")
/* Convert the entry to a link */
if(H5G__ent_to_link(udata->lnk, udata->heap, ent, name) < 0)