summaryrefslogtreecommitdiffstats
path: root/src/H5R.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-04-03 21:41:28 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-04-03 21:41:28 (GMT)
commit5630846ea34f29b45aecdb431f846327c4fde9e1 (patch)
tree83e65a0feb757f39472e70d2168048d091cfed50 /src/H5R.c
parent820b4dc39136072bccad1455fc0232ec9e710d58 (diff)
parentb9e5e2af4e31b0a60c2d2f6421fb1b3cb9aa0564 (diff)
downloadhdf5-5630846ea34f29b45aecdb431f846327c4fde9e1.zip
hdf5-5630846ea34f29b45aecdb431f846327c4fde9e1.tar.gz
hdf5-5630846ea34f29b45aecdb431f846327c4fde9e1.tar.bz2
[svn-r26724] - merge from trunk & fix conflicts.
- fix bug in opending an already open named datatype. - fix dynamically loaded VOL plugin support with new changes coming in.
Diffstat (limited to 'src/H5R.c')
-rw-r--r--src/H5R.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/H5R.c b/src/H5R.c
index 06c58ab..58cebd4 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -286,7 +286,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr);
/* Serialize the selection into heap buffer */
- if(H5S_SELECT_SERIALIZE(space, p) < 0)
+ if(H5S_SELECT_SERIALIZE(space, &p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection")
/* Save the serialized buffer for later */
@@ -411,6 +411,10 @@ done:
13 July 2011
I added the OAPL_ID parameter for the object being referenced. It only
supports dataset access property list currently.
+
+ M. Scot Breitenfeld
+ 3 March 2015
+ Added a check for undefined reference pointer.
--------------------------------------------------------------------------*/
hid_t
H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
@@ -435,8 +439,10 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type,
switch(ref_type) {
case H5R_OBJECT:
oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */
- break;
-
+ if(!H5F_addr_defined(oloc.addr) || oloc.addr == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
+ break;
+
case H5R_DATASET_REGION:
{
H5HG_t hobjid; /* Heap object ID */
@@ -448,6 +454,9 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type,
H5F_addr_decode(oloc.file, &p, &(hobjid.addr));
UINT32DECODE(p, hobjid.idx);
+ if(!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer")
+
/* Get the dataset region from the heap (allocate inside routine) */
if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)))
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
@@ -670,7 +679,7 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref)
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found")
/* Unserialize the selection */
- if(H5S_select_deserialize(ret_value, p) < 0)
+ if(H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection")
done: