From bfae878d8f2f65bc5f22f0d4bb314f326278ba7b Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Fri, 1 Jul 2016 10:31:44 -0500 Subject: [svn-r30131] Fix bug reported by Cisco Talos TALOS-CAN-0178. Added check for a message that should not be sharable being marked as sharable on disk, returns failure in this case. Needs testing. Tested: ummon --- release_docs/RELEASE.txt | 5 +++++ src/H5Ocache.c | 4 ++++ src/H5Opkg.h | 1 + 3 files changed, 10 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index bf2504b..052ba31 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -526,6 +526,11 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Fixed a memory bug that could occur when a message was improperly marked + as sharable on disk. + + (NAF, 2016/07/01, HDFFV-9950) + - Incorrect usage of list in CMake COMPILE_DEFINITIONS set_property The CMake command, set_property with COMPILE_DEFINITIONS property diff --git a/src/H5Ocache.c b/src/H5Ocache.c index e085242..fbbbe60 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1162,6 +1162,10 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message") if((flags & H5O_MSG_FLAG_WAS_UNKNOWN) && !(flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN)) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message") + if((flags & H5O_MSG_FLAG_SHAREABLE) + && H5O_msg_class_g[id] + && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unsharable class flagged as sharable") /* Reserved bytes/creation index */ if(oh->version == H5O_VERSION_1) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 14bb342..e40d28a 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -201,6 +201,7 @@ \ /* Set the message's "shared info", if it's shareable */ \ if((MSG)->flags & H5O_MSG_FLAG_SHAREABLE) { \ + HDassert(msg_type->share_flags & H5O_SHARE_IS_SHARABLE); \ H5O_UPDATE_SHARED((H5O_shared_t *)(MSG)->native, H5O_SHARE_TYPE_HERE, (F), msg_type->id, (MSG)->crt_idx, (OH)->chunk[0].addr) \ } /* end if */ \ \ -- cgit v0.12