summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2005-03-14 23:02:21 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2005-03-14 23:02:21 (GMT)
commitd1d9335d7a48bc43e7dda304e15caa517fedaabf (patch)
treef7b9102017482546f22f387e8b8c1e8b47e96b0d /src/H5I.c
parentfbcc3e84c0ca87fdd528afe74bf730618d4b23e5 (diff)
downloadhdf5-d1d9335d7a48bc43e7dda304e15caa517fedaabf.zip
hdf5-d1d9335d7a48bc43e7dda304e15caa517fedaabf.tar.gz
hdf5-d1d9335d7a48bc43e7dda304e15caa517fedaabf.tar.bz2
[svn-r10216]
Purpose: Bug fix Description: Calling H5Iobject_verify on an invalid type of ID (e.g., H5I_BADID) triggers an assert. Solution: Test for this condition and return an error instead of an assert. Added tests for this case. Platforms tested: sleipnir (minor change)
Diffstat (limited to 'src/H5I.c')
-rw-r--r--src/H5I.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/H5I.c b/src/H5I.c
index aef02ac..98b3c86 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -957,7 +957,7 @@ done:
* Failure: NULL
*
* Programmer: Nathaniel Furrer
- * James Laird
+ * James Laird
* Friday, April 23, 2004
*
* Modifications:
@@ -966,19 +966,24 @@ done:
*/
void *H5Iobject_verify(hid_t id, H5I_type_t id_type)
{
- void * ret_value; /* Return value */
+ void * ret_value; /* Return value */
- FUNC_ENTER_API(H5Iobject_verify, NULL);
+ FUNC_ENTER_API(H5Iobject_verify, NULL);
- if( H5I_IS_LIB_TYPE( id_type ) )
- {
- HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type");
- }
+ if( H5I_IS_LIB_TYPE( id_type ) )
+ {
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type");
+ }
- ret_value = H5I_object_verify(id, id_type);
+ if(id_type < 1 || id_type >= H5I_next_type)
+ {
+ HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type");
+ }
- done:
- FUNC_LEAVE_API(ret_value);
+ ret_value = H5I_object_verify(id, id_type);
+
+ done:
+ FUNC_LEAVE_API(ret_value);
}