summaryrefslogtreecommitdiffstats
path: root/src/H5Omessage.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2019-01-07 21:20:11 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2019-01-07 21:40:44 (GMT)
commitb043126e5e502d198b222139677bc08c9915a12b (patch)
treed7594f6cbdc7dc2264f4df71a042b5c744e40295 /src/H5Omessage.c
parente52e68c82f16a74551d7ce21976d87b40c6ddcd7 (diff)
downloadhdf5-b043126e5e502d198b222139677bc08c9915a12b.zip
hdf5-b043126e5e502d198b222139677bc08c9915a12b.tar.gz
hdf5-b043126e5e502d198b222139677bc08c9915a12b.tar.bz2
Delay checking if decoded message's "shareable" flag is appropriate for
the message type until we've verified we understand the message type. Reduce size of H5O_msg_class_g to *not* include space for H5O_BOGUS_INVALID. Make bogus messages shareable. Add new bogus message test with shareable messages to cover the formerly problematic code. Re-run gen_bogus.c to add this test case and also to fix the bogus_invalid messages that were no longer H5O_BOGUS_INVLAID due to a new message class being added in a previous commit. Added comment to remind developers to run gen_bogus.c when adding a new message class.
Diffstat (limited to 'src/H5Omessage.c')
-rw-r--r--src/H5Omessage.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index d6e3dce..18f3706 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1598,16 +1598,23 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- HDassert(type_id < NELMTS(H5O_msg_class_g));
- type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- HDassert(type);
- HDassert(mesg);
-
- /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */
- if(type->share_flags & H5O_SHARE_IS_SHARABLE)
- ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type);
- else
+#ifdef H5O_ENABLE_BOGUS
+ if(type_id >= NELMTS(H5O_msg_class_g))
ret_value = FALSE;
+ else
+#endif /* H5O_ENABLE_BOGUS */
+ {
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
+ HDassert(mesg);
+
+ /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */
+ if(type->share_flags & H5O_SHARE_IS_SHARABLE)
+ ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type);
+ else
+ ret_value = FALSE;
+ } /* end block/else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_is_shared() */