diff options
author | James Laird <jlaird@hdfgroup.org> | 2004-07-27 16:55:19 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2004-07-27 16:55:19 (GMT) |
commit | 5a19f181b35a0928d23c7c12fd7a0698b465855b (patch) | |
tree | 3516b75287980167182a4185e167a0ddff9bbf91 /src/H5Dio.c | |
parent | 7a07c6cc133e62f5f00e6a4baf214c9011657800 (diff) | |
download | hdf5-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/H5Dio.c')
-rw-r--r-- | src/H5Dio.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c index a480209..9fb860e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -224,6 +224,10 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t assert(buf_type); assert(space); + /* Make sure the dataspace has an extent set (or is NULL) */ + if( !(H5S_has_extent(space)) ) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set") + /* Get the memory and file datatype sizes */ src_type_size = H5T_get_size(fill_type); dst_type_size = H5T_get_size(buf_type); @@ -683,6 +687,12 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes") + /* Make sure that both selections have their extents set */ + if( !(H5S_has_extent(file_space)) ) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set") + if( !(H5S_has_extent(mem_space)) ) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set") + /* Retrieve dataset properties */ /* <none needed in the general case> */ @@ -933,6 +943,12 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes") + /* Make sure that both selections have their extents set */ + if( !(H5S_has_extent(file_space)) ) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set") + if( !(H5S_has_extent(mem_space)) ) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set") + /* Retrieve dataset properties */ /* <none needed currently> */ |