From 8427eefafe7af83dbc133975c3ac2368cf1b08d6 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 22 Jan 2018 17:40:44 -0600 Subject: Fix bounds check for the generation of cache image. --- src/H5Cimage.c | 5 ++++- src/H5Fint.c | 4 ---- src/H5Fsuper.c | 4 ---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 53d1712..be2560f 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1382,9 +1382,12 @@ H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id, hbool_t *image_generated * Note that under some error conditions, the superblock will be * undefined in this case as well -- if so, assume that the * superblock does not support superblock extension messages. + * Also verify that the file's high_bound is at least release + * 1.10.x, otherwise cancel the request for a cache image */ if((NULL == f->shared->sblock) || - (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2)) { + (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) || + (f->shared->high_bound < H5F_LIBVER_V110)) { H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL; cache_ptr->image_ctl = default_image_ctl; diff --git a/src/H5Fint.c b/src/H5Fint.c index 9d79481..86627ea 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -930,10 +930,6 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config") - /* Format version high bound does not allow the generation of metadata cache image */ - if(f->shared->mdc_initCacheImageCfg.generate_image && f->shared->high_bound < H5F_LIBVER_V110) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "format version out of bound for cache image") - /* Get the VFD values to cache */ f->shared->maxaddr = H5FD_get_maxaddr(lf); if(!H5F_addr_defined(f->shared->maxaddr)) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index d30434d..4250ff0 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -856,10 +856,6 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial hbool_t rw = ((rw_flags & H5AC__READ_ONLY_FLAG) == 0); H5O_mdci_t mdci_msg; - /* Message exists but version high bound does not allow it */ - if(f->shared->high_bound < H5F_LIBVER_V110) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "format version out of bound for metadata cache image") - /* if the metadata cache image superblock extension message exists, * read its contents and pass the data on to the metadata cache. * Given this data, the cache will load and decode the metadata -- cgit v0.12