diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-11 15:58:20 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-11 15:58:20 (GMT) |
commit | f7a792979818e5915b231174298caceef4f387bd (patch) | |
tree | 9d5b04280fdba798ed330ef98062c29cf563d5f1 /src/H5D.c | |
parent | c12b97f829ffada2d6af8c02dc5205c8639e9df3 (diff) | |
download | hdf5-f7a792979818e5915b231174298caceef4f387bd.zip hdf5-f7a792979818e5915b231174298caceef4f387bd.tar.gz hdf5-f7a792979818e5915b231174298caceef4f387bd.tar.bz2 |
[svn-r5585] Purpose:
Bug Fix
Description:
H5Dcreate and H5Tcommit allow "empty" compound and enumerated types (i.e.
ones with no members) to be stored in the file, but this causes an assertion
failure and is somewhat vapid.
Solution:
Check the datatype "makes sense" before using it for H5Dcreate and
H5Tcommit.
Platforms tested:
FreeBSD 4.5 (sleipnir)
Diffstat (limited to 'src/H5D.c')
-rw-r--r-- | src/H5D.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -984,8 +984,13 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, "memory allocation failed"); } + /* Check if the datatype is "sensible" for use in a dataset */ + if(H5T_is_sensible(type)!=TRUE) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible"); + /* Copy datatype for dataset */ - new_dset->type = H5T_copy(type, H5T_COPY_ALL); + if((new_dset->type = H5T_copy(type, H5T_COPY_ALL))==NULL) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy datatype"); /* Mark any VL datatypes as being on disk now */ if (H5T_vlen_mark(new_dset->type, f, H5T_VLEN_DISK)<0) { |