mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-18 17:40:55 +08:00
[svn-r17108] 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_id1/2, and possibly other API functions. Fixed to properly return failure. Tested: jam, linew, smirom (h5committest)
This commit is contained in:
parent
98b20f5bda
commit
02dc89e00b
@ -167,6 +167,8 @@ Bug Fixes since HDF5-1.8.0 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)
|
||||
|
@ -1115,7 +1115,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 */
|
||||
|
11
test/dsets.c
11
test/dsets.c
@ -5547,6 +5547,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;
|
||||
|
||||
@ -5587,6 +5588,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_id2(dcpl1,H5Z_FILTER_DEFLATE,&flags,NULL,NULL,0,NULL,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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user