summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-01-12 19:56:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-01-12 19:56:59 (GMT)
commit093c2fea18fa2266e4707ba7a21c7160516b5533 (patch)
treea621c0236afe2b3b4d13252e9d5e4abb0e581946
parenta1551e334d3cae6a4c0aa1e075a9f397648dddb3 (diff)
downloadhdf5-093c2fea18fa2266e4707ba7a21c7160516b5533.zip
hdf5-093c2fea18fa2266e4707ba7a21c7160516b5533.tar.gz
hdf5-093c2fea18fa2266e4707ba7a21c7160516b5533.tar.bz2
[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)
-rw-r--r--src/H5D.c17
1 files changed, 17 insertions, 0 deletions
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; u<new_dset->layout.ndims-1; u++) {
+ if (max_dim[u]!=H5S_UNLIMITED && max_dim[u]<new_dset->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; u<new_dset->layout.ndims-1; u++) {
new_dset->layout.dim[u] = new_dset->create_parms->chunk_size[u];
}