diff options
-rw-r--r-- | src/H5Oginfo.c | 24 | ||||
-rw-r--r-- | src/H5Opkg.h | 8 | ||||
-rw-r--r-- | src/H5Oprivate.h | 8 | ||||
-rw-r--r-- | src/H5Pgcpl.c | 14 | ||||
-rw-r--r-- | test/stab.c | 8 |
5 files changed, 38 insertions, 24 deletions
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index f7c834f..95a19ab 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -119,12 +119,12 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p) ginfo->track_corder = (flags & H5O_GINFO_FLAG_TRACK_CORDER) ? TRUE : FALSE; /* Get the max. # of links to store compactly & the min. # of links to store densely */ - UINT32DECODE(p, ginfo->max_compact) - UINT32DECODE(p, ginfo->min_dense) + UINT16DECODE(p, ginfo->max_compact) + UINT16DECODE(p, ginfo->min_dense) /* Get the estimated # of entries & name lengths */ - UINT32DECODE(p, ginfo->est_num_entries) - UINT32DECODE(p, ginfo->est_name_len) + UINT16DECODE(p, ginfo->est_num_entries) + UINT16DECODE(p, ginfo->est_name_len) /* Set return value */ ret_value = ginfo; @@ -174,12 +174,12 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) *p++ = flags; /* Store the max. # of links to store compactly & the min. # of links to store densely */ - UINT32ENCODE(p, ginfo->max_compact) - UINT32ENCODE(p, ginfo->min_dense) + UINT16ENCODE(p, ginfo->max_compact) + UINT16ENCODE(p, ginfo->min_dense) /* Estimated # of entries & name lengths */ - UINT32ENCODE(p, ginfo->est_num_entries) - UINT32ENCODE(p, ginfo->est_name_len) + UINT16ENCODE(p, ginfo->est_num_entries) + UINT16ENCODE(p, ginfo->est_name_len) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_ginfo_encode() */ @@ -257,10 +257,10 @@ H5O_ginfo_size(const H5F_t UNUSED *f, const void UNUSED *_mesg) /* Set return value */ ret_value = 1 + /* Version */ 1 + /* Flags */ - 4 + /* "Max compact" links */ - 4 + /* "Min dense" links */ - 4 + /* Estimated # of entries in group */ - 4; /* Estimated length of name of entry in group */ + 2 + /* "Max compact" links */ + 2 + /* "Min dense" links */ + 2 + /* Estimated # of entries in group */ + 2; /* Estimated length of name of entry in group */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_ginfo_size() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 18a0804..657da10 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -188,22 +188,22 @@ struct H5O_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ /* first field in structure */ - /* General information */ + /* General information (stored) */ unsigned version; /*version number */ unsigned nlink; /*link count */ - /* Time information */ + /* Time information (stored) */ time_t atime; /*access time */ time_t mtime; /*modification time */ time_t ctime; /*change time */ - /* Message management */ + /* Message management (stored, indirectly) */ size_t nmesgs; /*number of messages */ size_t alloc_nmesgs; /*number of message slots */ H5O_mesg_t *mesg; /*array of messages */ size_t skipped_mesg_size; /*size of skipped messages (for sanity checking) */ - /* Chunk management */ + /* Chunk management (not stored) */ size_t nchunks; /*number of chunks */ size_t alloc_nchunks; /*chunks allocated */ H5O_chunk_t *chunk; /*array of chunks */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 05b85e3..61fa573 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -315,12 +315,12 @@ typedef struct H5O_ginfo_t { hbool_t track_corder; /* Are creation order values tracked on links? */ /* (storage management info) */ - uint32_t max_compact; /* Maximum # of compact links */ - uint32_t min_dense; /* Minimum # of "dense" links */ + uint16_t max_compact; /* Maximum # of compact links */ + uint16_t min_dense; /* Minimum # of "dense" links */ /* (initial object header size info) */ - uint32_t est_num_entries; /* Estimated # of entries in group */ - uint32_t est_name_len; /* Estimated length of entry name */ + uint16_t est_num_entries; /* Estimated # of entries in group */ + uint16_t est_name_len; /* Estimated length of entry name */ } H5O_ginfo_t; /* diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 16046db..cc9449a 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -235,6 +235,14 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens FUNC_ENTER_API(H5Pset_link_phase_change, FAIL) H5TRACE3("e","iIuIu",plist_id,max_compact,min_dense); + /* Range check values */ + if(max_compact < min_dense) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be >= min dense value") + if(max_compact > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be < 65536") + if(min_dense > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min dense value must be < 65536") + /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") @@ -329,6 +337,12 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name FUNC_ENTER_API(H5Pset_est_link_info, FAIL) H5TRACE3("e","iIuIu",plist_id,est_num_entries,est_name_len); + /* Range check values */ + if(est_num_entries > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. number of entries must be < 65536") + if(est_name_len > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. name length must be < 65536") + /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") diff --git a/test/stab.c b/test/stab.c index 1f8528d..2bb1cab 100644 --- a/test/stab.c +++ b/test/stab.c @@ -426,9 +426,9 @@ lifecycle(hid_t fapl) /* Check that the object header is only one chunk and the space has been allocated correctly */ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR #ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.ohdr.size != 217) TEST_ERROR -#else /* H5_HAVE_LARGE_HSIZET */ if(obj_stat.ohdr.size != 209) TEST_ERROR +#else /* H5_HAVE_LARGE_HSIZET */ + if(obj_stat.ohdr.size != 201) TEST_ERROR #endif /* H5_HAVE_LARGE_HSIZET */ if(obj_stat.ohdr.free != 0) TEST_ERROR if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR @@ -452,9 +452,9 @@ lifecycle(hid_t fapl) /* Check that the object header is still one chunk and the space has been allocated correctly */ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR #ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.ohdr.size != 217) TEST_ERROR -#else /* H5_HAVE_LARGE_HSIZET */ if(obj_stat.ohdr.size != 209) TEST_ERROR +#else /* H5_HAVE_LARGE_HSIZET */ + if(obj_stat.ohdr.size != 201) TEST_ERROR #endif /* H5_HAVE_LARGE_HSIZET */ if(obj_stat.ohdr.free != 116) TEST_ERROR if(obj_stat.ohdr.nmesgs != 3) TEST_ERROR |