[svn-r8962] Purpose:

Bug fix

Description:
    Allow I/O on extendible chunked datasets with (currently) zero-sized
dimensions to proceed harmlessly instead of dumping core on an assertion.

Solution:
    Removed assertion and added checks to avoid problem situation in H5TB_end

Platforms tested:
    FreeBSD 4.10 (sleipnir) w/ & w/o parallel
    Too minor to require h5committest
This commit is contained in:
Quincey Koziol 2004-07-27 22:22:12 -05:00
parent 4c7a64cc73
commit ae0ae15956
3 changed files with 58 additions and 3 deletions

View File

@ -168,6 +168,9 @@ Bug Fixes since HDF5-1.6.0 release
Library
-------
- Fixed bug where I/O to an extendible chunked dataset with zero-sized
dimensions would cause library to fail an assertion.
QAK - 2004/07/27
- Fixed bug where chunked datasets which have filters defined,
allocation time set to "late" and whose chunks don't align with
the dataspace bounds could have incorrect data stored when

View File

@ -1285,11 +1285,11 @@ H5TB_end(H5TB_NODE * root, int side)
{
FUNC_ENTER_NOAPI_NOFUNC(H5TB_end);
assert(root);
assert(side==LEFT || side==RIGHT);
while (HasChild(root, side))
root = root->link[side];
if(root)
while (HasChild(root, side))
root = root->link[side];
FUNC_LEAVE_NOAPI(root);
} /* end H5TB_end() */

View File

@ -113,6 +113,10 @@ const char *FILENAME[] = {
#define NOENCODER_TEST_DATASET "noencoder_tdset.h5"
#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5"
#define NOENCODER_SZIP_SHUFF_FLETCH_DATASET "noencoder_szip_shuffle_fletcher_dset.h5"
/* Names for zero-dim test */
#define ZERODIM_DATASET "zerodim"
/* Shared global arrays */
#define DSET_DIM1 100
#define DSET_DIM2 200
@ -3624,6 +3628,53 @@ error:
return -1;
} /* end test_filters_endianess() */
/*-------------------------------------------------------------------------
* Function: test_zero_dims
*
* Purpose: Tests read/writes to zero-sized extendible datasets
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Quincey Koziol
* Tuesday, July 27, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
test_zero_dims(hid_t file)
{
hid_t s=-1, d=-1, dcpl=-1;
hsize_t dsize=0, dmax=H5S_UNLIMITED, csize=5;
TESTING("I/O on datasets with zero-sized dims");
if((s = H5Screate_simple(1, &dsize, &dmax))<0) TEST_ERROR;
if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR;
if(H5Pset_chunk(dcpl, 1, &csize)<0) TEST_ERROR;
if((d = H5Dcreate(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, dcpl))<0) TEST_ERROR;
if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911)<0) TEST_ERROR;
if(H5Pclose(dcpl)<0) TEST_ERROR;
if(H5Sclose(s)<0) TEST_ERROR;
if(H5Dclose(d)<0) TEST_ERROR;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Pclose(dcpl);
H5Dclose(d);
H5Sclose(s);
} H5E_END_TRY;
return -1;
} /* end test_zero_dims() */
/*-------------------------------------------------------------------------
* Function: main
@ -3693,6 +3744,7 @@ main(void)
nerrors += test_compare_dcpl(file)<0 ?1:0;
nerrors += test_filter_delete(file)<0 ?1:0;
nerrors += test_filters_endianess()<0 ?1:0;
nerrors += test_zero_dims(file)<0 ?1:0;
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;