summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2015-03-10 22:03:53 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2015-03-10 22:03:53 (GMT)
commit878149c4a2d17de7d157c246c1db88db41ec1f70 (patch)
treeb8eec0ec6efd9abc81231ab7912e2f3e958d6723 /src
parentd928aca8e63d7c5dd73721c634514a5ce951b54e (diff)
downloadhdf5-878149c4a2d17de7d157c246c1db88db41ec1f70.zip
hdf5-878149c4a2d17de7d157c246c1db88db41ec1f70.tar.gz
hdf5-878149c4a2d17de7d157c246c1db88db41ec1f70.tar.bz2
[svn-r26419] merged r26373 and r26380 from the trunk into the branch.
tested: h5committest
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 c36c2fa..1e99b86 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -409,6 +409,10 @@ done:
Currently only set up to work with references to datasets
EXAMPLES
REVISION LOG
+
+ M. Scot Breitenfeld
+ 3 March 2015
+ Added a check for undefined reference pointer.
--------------------------------------------------------------------------*/
static hid_t
H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref)
@@ -433,8 +437,10 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
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 */
@@ -446,6 +452,9 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
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")