From 093c2fea18fa2266e4707ba7a21c7160516b5533 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 12 Jan 2001 14:56:59 -0500 Subject: [svn-r3280] Purpose: Bug fix Description: Datasets were allowed to be created with chunks larger than the maximum dimension for each dimension. Solution: Compare chunk sizes against maximum dimensions and reject dataset creations which have chunks too large for the dimensions in the dataspace. Platforms tested: FreeBSD 4.2 (hawkwind) --- src/H5D.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/H5D.c b/src/H5D.c index 81f715c..2f50613 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1055,6 +1055,23 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL, "external storage not supported with chunked layout"); } + + /* + * The chunk size of a dimension with a fixed size cannot exceed + * the maximum dimension size + */ + if (H5S_get_simple_extent_dims(space, NULL, max_dim)<0) { + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, + "unable to query maximum dimensions"); + } + for (u=0; ulayout.ndims-1; u++) { + if (max_dim[u]!=H5S_UNLIMITED && max_dim[u]create_parms->chunk_size[u]) { + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "chunk size must be <= maximum dimension size for fixed-sized dimensions"); + } + } + + /* Set the dataset's chunk sizes from the property list's chunk sizes */ for (u=0; ulayout.ndims-1; u++) { new_dset->layout.dim[u] = new_dset->create_parms->chunk_size[u]; } -- cgit v0.12