From a1f3523478a1ae83db99bae92b9d677915abfc48 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 19 Aug 2008 14:37:35 -0500 Subject: [svn-r15488] Description: Fix bug where library could core dump when an invalid location ID was passed to H5Giterate() (and add test for this case). Tested on: Mac OS X/32 10.5.4 (amazon) Too minor to require h5committest --- src/H5G.c | 2 +- test/links.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/H5G.c b/src/H5G.c index 9a40f22..8387c3f 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -1649,7 +1649,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Location of parent for group */ hid_t gid = -1; /* ID of group to iterate over */ - H5G_t *grp; /* Pointer to group data structure to iterate over */ + H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ H5G_iter_appcall_ud_t udata; /* User data for callback */ herr_t ret_value; /* Return value */ diff --git a/test/links.c b/test/links.c index 0d89fd2..c49d966 100644 --- a/test/links.c +++ b/test/links.c @@ -9734,6 +9734,20 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, } H5E_END_TRY; if(ret >= 0) TEST_ERROR + /* Check for iteration w/bad location ID */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate((-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5E_BEGIN_TRY { + ret = H5Giterate((-1), ".", &gskip, group_iterate_old_cb, iter_info); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + /* Success */ return(0); -- cgit v0.12