summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2015-03-05 21:42:42 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2015-03-05 21:42:42 (GMT)
commitca0a4d24b62980263c6b632550028789a587f7a4 (patch)
treec6f868ea973e2c94946e8e15338adcc973236132 /src
parent61dcc807af6288831117100a370b537fd9d6d041 (diff)
downloadhdf5-ca0a4d24b62980263c6b632550028789a587f7a4.zip
hdf5-ca0a4d24b62980263c6b632550028789a587f7a4.tar.gz
hdf5-ca0a4d24b62980263c6b632550028789a587f7a4.tar.bz2
[svn-r26373] Fix for HDFFV-7959:
H5Rdereference should check for default (HADDR_UNDEF) value and not continue processing and return so that ret value can be checked and handled properly Tested: jam (gnu)
Diffstat (limited to 'src')
-rw-r--r--src/H5R.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/H5R.c b/src/H5R.c
index 26f4b9d..9b99914 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -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")