summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-07-27 16:55:19 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-07-27 16:55:19 (GMT)
commit5a19f181b35a0928d23c7c12fd7a0698b465855b (patch)
tree3516b75287980167182a4185e167a0ddff9bbf91 /src/H5D.c
parent7a07c6cc133e62f5f00e6a4baf214c9011657800 (diff)
downloadhdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.zip
hdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.tar.gz
hdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.tar.bz2
[svn-r8953]
Purpose: Bug fix Description: When a simple dataspace is created, its extent should be set before using it, or it will silently function as a NULL dataspace. Solution: Added checks on user-supplied dataspaces. Now dataspaces without extents set will throw errors; users must explicitly set a dataspace to be NULL. Platforms tested: sleipnir, windows
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/H5D.c b/src/H5D.c
index cf761c7..177e3e1 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -2135,6 +2135,10 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
if(H5T_detect_class(type, H5T_VLEN))
has_vl_type=TRUE;
+ /* Check if the dataspace has an extent set (or is NULL) */
+ if( !(H5S_has_extent(space)) )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "dataspace extent has not been set.")
+
/* Initialize the dataset object */
if(NULL == (new_dset = H5D_new(dcpl_id,TRUE,has_vl_type)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -3559,6 +3563,8 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype")
if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
+ if( !(H5S_has_extent(space)) )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
ret_value=H5S_select_iterate(buf,type_id,space,op,operator_data);