summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt3
-rw-r--r--src/H5Z.c6
-rw-r--r--src/H5Zszip.c4
-rw-r--r--test/dsets.c55
4 files changed, 65 insertions, 3 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index b9f9663..d2d09fc 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -71,6 +71,9 @@ Bug Fixes since HDF5-1.6.1 release
Library
-------
+ - Detect situation where szip 'pixels per block' is larger than the
+ fastest changing dimension of a dataset's chunk size and disallow
+ this (due to limits in szip library). QAK - 2003/12/31
- Fixed bug with flattened hyperslab selections that would generate
incorrect hyperslab information with certain high-dimensionality
combinations of start/stride/count/block information.
diff --git a/src/H5Z.c b/src/H5Z.c
index c687da8..bf721b6 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -575,7 +575,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
/* Check return value */
if(status<=0) {
/* We're leaving, so close dataspace */
- if(H5Sclose(space_id)<0)
+ if(H5I_dec_ref(space_id)<0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace");
/* Indicate filter can't apply to this combination of parameters */
@@ -596,7 +596,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
/* Make callback to filter's "set local" function */
if((fclass->set_local)(dcpl_id, type_id, space_id)<0) {
/* We're leaving, so close dataspace */
- if(H5Sclose(space_id)<0)
+ if(H5I_dec_ref(space_id)<0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace");
/* Indicate error during filter callback */
@@ -612,7 +612,7 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty
} /* end for */
/* Close dataspace */
- if(H5Sclose(space_id)<0)
+ if(H5I_dec_ref(space_id)<0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace");
} /* end if */
} /* end if */
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index d081521..76cf017 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -129,6 +129,10 @@ H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
if(scanline > SZ_MAX_PIXELS_PER_SCANLINE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid scanline size");
+ /* Range check the pixels per block against the 'scanline' size */
+ if(scanline<cd_values[H5Z_SZIP_PARM_PPB])
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "pixels per block greater than scanline");
+
/* Range check the scanline's number of blocks */
if((scanline/cd_values[H5Z_SZIP_PARM_PPB]) > SZ_MAX_BLOCKS_PER_SCANLINE)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid number of blocks per scanline");
diff --git a/test/dsets.c b/test/dsets.c
index dbe215b..185832f 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2590,7 +2590,9 @@ file)
unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block;
const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
+ const hsize_t dims2[2] = {4, 2}; /* Dataspace dimensions */
const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
+ const hsize_t chunk_dims2[2] = {2, 1}; /* Chunk dimensions */
herr_t ret; /* Status value */
#else /* H5_HAVE_FILTER_SZIP */
const char *not_supported= " Szip filter is not enabled.";
@@ -2674,6 +2676,59 @@ file)
goto error;
} /* end if */
+ /* Create another data space */
+ if ((sid = H5Screate_simple(2, dims2, NULL))<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't open dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Create dcpl with special filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't create dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims2)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Set (invalid at dataset creation time) szip parameters */
+ szip_pixels_per_block=32;
+ if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set szip filter\n",__LINE__);
+ goto error;
+ }
+
+ /* Create new dataset */
+ /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
+ H5E_BEGIN_TRY {
+ dsid = H5Dcreate(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, dcpl);
+ } H5E_END_TRY;
+ if (dsid >=0) {
+ H5_FAILED();
+ printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ H5Dclose(dsid);
+ goto error;
+ } /* end if */
+
+ /* Close dataspace */
+ if(H5Sclose(sid)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Close dataset creation property list */
+ if(H5Pclose(dcpl)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+
PASSED();
#else /* H5_HAVE_FILTER_SZIP */