summaryrefslogtreecommitdiffstats
path: root/src/H5R.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-10-17 20:46:57 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-10-17 20:46:57 (GMT)
commit2011215517e50ae231f89c9d24ce826d76315e00 (patch)
tree1a1f842218cb64d9cf21eaee26437c64676ad213 /src/H5R.c
parentbfd52032e36f265c3a2829595a29f480903e9b30 (diff)
downloadhdf5-2011215517e50ae231f89c9d24ce826d76315e00.zip
hdf5-2011215517e50ae231f89c9d24ce826d76315e00.tar.gz
hdf5-2011215517e50ae231f89c9d24ce826d76315e00.tar.bz2
[svn-r2689] Purpose:
Bug fix. Description: Previously, it has been possible to dereference deleted objects in a file. Obviously, this is incorrect and could cause all sorts of problems if the object being dereferenced had been partially over-written with other information. - This is documented in Bug #493. Solution: Check the link count for objects being dereferenced and don't allow any objects with link counts of zero to be dereferenced. This fixes bug #493. Platforms tested: FreeBSD 4.1.1 (hawkwind)
Diffstat (limited to 'src/H5R.c')
-rw-r--r--src/H5R.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/H5R.c b/src/H5R.c
index b9240bd..ec821ab 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -409,6 +409,10 @@ H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref)
"internal error (unknown reference type)");
} /* end switch */
+ /* Check to make certain that this object hasn't been deleted since the reference was created */
+ if(H5O_link(&ent,0)<=0)
+ HRETURN_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object");
+
/* Open the dataset object */
oid_type=H5G_get_type(&ent);
switch(oid_type) {