summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2019-01-07 21:20:11 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2019-03-15 16:48:06 (GMT)
commit0ab95e0c814ab975ccaafd6ef25dbdde13b00f11 (patch)
treea6a97478164569d6316c31374c8b7f6be8cc4399 /src/H5Ocache.c
parent79f9b443dae87482326bb9a37a1a8070c1f8669d (diff)
downloadhdf5-0ab95e0c814ab975ccaafd6ef25dbdde13b00f11.zip
hdf5-0ab95e0c814ab975ccaafd6ef25dbdde13b00f11.tar.gz
hdf5-0ab95e0c814ab975ccaafd6ef25dbdde13b00f11.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/H5Ocache.c')
-rw-r--r--src/H5Ocache.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 39f3ca3..8e7690e 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -1128,10 +1128,9 @@ 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")
+ /* Delay checking the "shareable" flag until we've made sure id
+ * references a valid message class that this version of the library
+ * knows about */
/* Reserved bytes/creation index */
if(oh->version == H5O_VERSION_1)
@@ -1236,9 +1235,17 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
*dirty = TRUE;
} /* end if */
} /* end if */
- else
+ else {
+ /* Check for message of unshareable class marked as "shareable"
+ */
+ 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 unshareable class flagged as shareable")
+
/* Set message class for "known" messages */
oh->mesg[mesgno].type = H5O_msg_class_g[id];
+ } /* end else */
} /* end else */
/* Advance decode pointer past message */