diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2009-06-25 19:12:07 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2009-06-25 19:12:07 (GMT) |
commit | baceb1c180ecf0ad6b4fda75319ac5623d0d9335 (patch) | |
tree | d15d0ed6a04062be016c0a55b46799a69c0b1174 | |
parent | d3a94dc004ab8251e52eaf9ee823c06bd2b1736a (diff) | |
download | hdf5-baceb1c180ecf0ad6b4fda75319ac5623d0d9335.zip hdf5-baceb1c180ecf0ad6b4fda75319ac5623d0d9335.tar.gz hdf5-baceb1c180ecf0ad6b4fda75319ac5623d0d9335.tar.bz2 |
[svn-r17110] Purpose: Fix bug in H5Z_filter_info
Description:
Previously, when H5Z_filter_info was called for a filter that was not present,
it would succeed and return the information from one position past the end of
the pipeline, possibly causing a segfault. This affected at least
H5Pget_fitler_by_id, and possibly other API functions. Fixed to properly
return failure.
Tested: jam
-rw-r--r-- | release_docs/RELEASE.txt | 2 | ||||
-rw-r--r-- | src/H5Z.c | 2 | ||||
-rw-r--r-- | test/dsets.c | 11 |
3 files changed, 14 insertions, 1 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index cabdcc9..edbcae2 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -77,6 +77,8 @@ Bug Fixes since HDF5-1.6.9 Release ================================== Library ------- + - Fixed a bug where H5Pget_fitler_by_id would succeed when called for a + filter that wasn't present. (NAF - 2009/06/25) - Fixed an issue with committed compound datatypes containing a vlen. Also fixed memory leaks involving committed datatypes. NAF - 2009/06/10 - 1593 @@ -1086,7 +1086,7 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) break; /* Check if the filter was not already in the pipeline */ - if(idx>pline->nused) + if(idx>=pline->nused) HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") /* Set return value */ diff --git a/test/dsets.c b/test/dsets.c index 2623a58..80a9c8b 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -3424,6 +3424,7 @@ test_filter_delete(hid_t file) hsize_t dims[2]={20,20}; /* dataspace dimensions */ hsize_t chunk_dims[2]={10,10}; /* chunk dimensions */ int nfilters; /* number of filters in DCPL */ + unsigned flags; /* flags for filter */ herr_t ret; /* generic return value */ int i; @@ -3464,6 +3465,16 @@ test_filter_delete(hid_t file) goto error; } + /* try to get the info for the deflate filter */ + H5E_BEGIN_TRY { + ret=H5Pget_filter_by_id(dcpl1,H5Z_FILTER_DEFLATE,&flags,NULL,NULL,0,NULL); + } H5E_END_TRY; + if(ret >=0) { + H5_FAILED(); + printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + goto error; + } /* end if */ + /* try to delete the deflate filter again */ H5E_BEGIN_TRY { ret=H5Premove_filter(dcpl1,H5Z_FILTER_DEFLATE); |