summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2010-04-15 21:02:29 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2010-04-15 21:02:29 (GMT)
commit5dfdf41dfc2ca4f22529effacc0913681fae7e34 (patch)
tree13d2db677ca0689f1fc3c0fd3822eb4ab4e2c3c0
parent3bdba7549081b2290703b8f16a27c40ad55b3121 (diff)
downloadhdf5-5dfdf41dfc2ca4f22529effacc0913681fae7e34.zip
hdf5-5dfdf41dfc2ca4f22529effacc0913681fae7e34.tar.gz
hdf5-5dfdf41dfc2ca4f22529effacc0913681fae7e34.tar.bz2
[svn-r18577] Fix for Bug 1741:
H5Rcreate given a region reference with a space_id of -1 throws assert and crashes on Windows machines. Add check for case and return error. Tested: Windows amd local linux
-rw-r--r--src/H5R.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/H5R.c b/src/H5R.c
index d14b9fc..ada2269 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -309,7 +309,7 @@ herr_t
H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
{
H5G_loc_t loc; /* File location */
- H5S_t *space; /* Pointer to dataspace containing region */
+ H5S_t *space = NULL; /* Pointer to dataspace containing region */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(H5Rcreate, FAIL)
@@ -326,6 +326,8 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type")
if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION)
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported")
+ if(space_id == (-1) && ref_type == H5R_DATASET_REGION)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")