diff options
author | James Laird <jlaird@hdfgroup.org> | 2007-01-03 17:48:51 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2007-01-03 17:48:51 (GMT) |
commit | 11af96e8677f8d22a3bacb745eee09576fdb9eec (patch) | |
tree | 1372985494999cf48ceb1b397e2f2271e518c85f /src/H5SM.c | |
parent | b5a2e7c634b438c3681b8c40c3fd8e9ab7d3e442 (diff) | |
download | hdf5-11af96e8677f8d22a3bacb745eee09576fdb9eec.zip hdf5-11af96e8677f8d22a3bacb745eee09576fdb9eec.tar.gz hdf5-11af96e8677f8d22a3bacb745eee09576fdb9eec.tar.bz2 |
[svn-r13102] Found a bug: shared message list sizes above the maximum were not caught.
Fixed bug and a related one where the number of indexes could be set
above the maximum.
Added tests for both bugs.
Tested on kagiso and smirom.
Diffstat (limited to 'src/H5SM.c')
-rwxr-xr-x | src/H5SM.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -67,7 +67,7 @@ static herr_t H5SM_type_to_flag(unsigned type_id, unsigned *type_flag); /*********************/ H5FL_DEFINE(H5SM_master_table_t); -H5FL_ARR_DEFINE(H5SM_index_header_t, H5SM_MAX_INDEXES); +H5FL_ARR_DEFINE(H5SM_index_header_t, H5SM_MAX_NINDEXES); H5FL_DEFINE(H5SM_list_t); H5FL_ARR_DEFINE(H5SM_sohm_t, H5SM_MAX_LIST_ELEMS); @@ -105,8 +105,8 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id) haddr_t table_addr = HADDR_UNDEF; unsigned num_indexes; unsigned list_to_btree, btree_to_list; - unsigned index_type_flags[H5SM_MAX_NUM_INDEXES]; - unsigned minsizes[H5SM_MAX_NUM_INDEXES]; + unsigned index_type_flags[H5SM_MAX_NINDEXES]; + unsigned minsizes[H5SM_MAX_NINDEXES]; unsigned type_flags_used; unsigned x; hsize_t table_size; @@ -135,7 +135,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM message min sizes") /* Verify that values are valid */ - if(num_indexes > H5SM_MAX_NUM_INDEXES) + if(num_indexes > H5SM_MAX_NINDEXES) HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "number of indexes in property list is too large") /* Check that type flags weren't duplicated anywhere */ @@ -162,7 +162,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id) * min. */ HDassert(list_to_btree + 1 >= btree_to_list); - HDassert(table->num_indexes > 0 && table->num_indexes <= H5SM_MAX_NUM_INDEXES); + HDassert(table->num_indexes > 0 && table->num_indexes <= H5SM_MAX_NINDEXES); /* Allocate the SOHM indexes as an array. */ if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) |