summaryrefslogtreecommitdiffstats
path: root/src/H5Gstab.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-20 21:01:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-20 21:01:28 (GMT)
commit335978f235277f12a87fb198a5fd1a0e43ce5734 (patch)
tree63d1ced7d5079d67992998b6cff21454e73ecd51 /src/H5Gstab.c
parent8d9964cf02cd13318029856b3becb70b8bb01f69 (diff)
downloadhdf5-335978f235277f12a87fb198a5fd1a0e43ce5734.zip
hdf5-335978f235277f12a87fb198a5fd1a0e43ce5734.tar.gz
hdf5-335978f235277f12a87fb198a5fd1a0e43ce5734.tar.bz2
[svn-r12952] Description:
Add tests for H5Literate(), in all combinations. Sweep up a few minor issues with H5Literate() that the tests exposed. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r--src/H5Gstab.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index c982b6b..76cefe1 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -470,6 +470,11 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
if((ret_value = H5B_iterate(oloc->file, dxpl_id, H5B_SNODE,
H5G_node_iterate, stab.btree_addr, &udata)) < 0)
HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
+
+ /* Check for too high of a starting index (ex post facto :-) */
+ /* (Skipping exactly as many entries as are in the group is currently an error) */
+ if(skip > 0 && skip >= *last_lnk)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
} /* end if */
else {
H5G_bt_it_bt_t udata; /* User data to pass to B-tree callback */
@@ -484,6 +489,10 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
stab.btree_addr, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to build link table")
+ /* Check for skipping out of bounds */
+ if(skip > 0 && (size_t)skip >= ltable.nlinks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
+
/* Sort link table in correct iteration order */
if(H5G_link_sort_table(&ltable, H5L_INDEX_NAME, order) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages")