summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1998-07-21 20:39:10 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1998-07-21 20:39:10 (GMT)
commitde5389cc272c7610b2f6ea7510bd9222c780fb1b (patch)
tree1be6a70b7ec416adc47d808aab6bf7de756b3568 /src/H5D.c
parentbdce66f69a4f976fd3013c54b0f8f9f137bff8f5 (diff)
downloadhdf5-de5389cc272c7610b2f6ea7510bd9222c780fb1b.zip
hdf5-de5389cc272c7610b2f6ea7510bd9222c780fb1b.tar.gz
hdf5-de5389cc272c7610b2f6ea7510bd9222c780fb1b.tar.bz2
[svn-r524] Fixed potential core dump on freeing uninitialized selection iterators in
H5D_read and H5D_write.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 65cb0b8..d4efe4a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1250,6 +1250,12 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
assert(mem_type);
assert(xfer_parms);
assert(buf);
+
+ /* Initialize these before any errors can occur */
+ HDmemset(&mem_iter,0,sizeof(H5S_sel_iter_t));
+ HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t));
+ HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t));
+
if (!file_space) {
if (NULL==(free_this_space=H5S_read (&(dataset->ent)))) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
@@ -1555,9 +1561,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5T_conv_t tconv_func = NULL; /*conversion function */
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
H5S_conv_t sconv_func= {NULL}; /*space conversion funcs*/
- H5S_sel_iter_t mem_iter, /* memory selection iteration information */
- bkg_iter, /* background iteration information */
- file_iter; /* file selection iteration information */
+ H5S_sel_iter_t mem_iter, /* memory selection iteration information */
+ bkg_iter, /* background iteration information */
+ file_iter; /* file selection iteration information */
H5T_cdata_t *cdata = NULL; /*type conversion data */
herr_t ret_value = FAIL, status;
size_t src_type_size; /*size of source type */
@@ -1577,6 +1583,12 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
assert(mem_type);
assert(xfer_parms);
assert(buf);
+
+ /* Initialize these before any errors can occur */
+ HDmemset(&mem_iter,0,sizeof(H5S_sel_iter_t));
+ HDmemset(&bkg_iter,0,sizeof(H5S_sel_iter_t));
+ HDmemset(&file_iter,0,sizeof(H5S_sel_iter_t));
+
if (!file_space) {
if (NULL==(free_this_space=H5S_read (&(dataset->ent)))) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,