summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-03-11 22:25:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-03-11 22:25:46 (GMT)
commit4982e156232a6f2b5f6c66bd31d7c997a5b606bc (patch)
tree951c3a7f4c0b79d99b056560f69c5ce53cd05852
parentda9a26d9a50defeb0631d29e1fc487c791635c58 (diff)
downloadhdf5-4982e156232a6f2b5f6c66bd31d7c997a5b606bc.zip
hdf5-4982e156232a6f2b5f6c66bd31d7c997a5b606bc.tar.gz
hdf5-4982e156232a6f2b5f6c66bd31d7c997a5b606bc.tar.bz2
[svn-r14722] Description:
Minor bug fix to H5Aget_num_attrs() to return error when an invalid location ID is passed in. Tested on: Mac OS X/32 (amazon) Too minor to require h5committest
-rw-r--r--release_docs/RELEASE.txt3
-rw-r--r--src/H5Adeprec.c2
-rw-r--r--test/tattr.c4
3 files changed, 9 insertions, 0 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index e65baf3..3139f74 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -91,6 +91,9 @@ Bug Fixes since HDF5-1.8.0
Library
-------
+ - Fixed bug in H5Aget_num_attrs() routine to handle invalid location
+ ID correctly. (QAK - 2008/03/11)
+
Parallel Library
----------------
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 9f888c8..85cef2f 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -312,6 +312,8 @@ H5Aget_num_attrs(hid_t loc_id)
H5TRACE1("Is", "i", loc_id);
/* check arguments */
+ if(H5I_BADID == H5I_get_type(loc_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID")
if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(NULL == (obj = H5I_object(loc_id)))
diff --git a/test/tattr.c b/test/tattr.c
index d448397..12350c3 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -3303,6 +3303,10 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
+ /* Get number of attributes with bad ID */
+ ret = H5Aget_num_attrs(-1);
+ VERIFY(ret, FAIL, "H5Aget_num_attrs");
+
/* Get number of attributes */
ret = H5Aget_num_attrs(dataset);
VERIFY(ret, 1, "H5Aget_num_attrs");