From c5cd064a8842be7d5369bd93f762d17f80ed44a9 Mon Sep 17 00:00:00 2001 From: MuQun Yang Date: Wed, 29 Nov 2000 14:05:47 -0500 Subject: [svn-r3023] Purpose: bug fix (zeroing memory for memory allocating for the name of dimensional list) Description: At modi4, test failed due to garbage read for name of dimensional list. Solution: zeroing out memory before writing the name. Platforms tested: modi4, eirene(Linux) --- tools/h4toh5sds.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/h4toh5sds.c b/tools/h4toh5sds.c index 6c07724..3781e63 100644 --- a/tools/h4toh5sds.c +++ b/tools/h4toh5sds.c @@ -717,6 +717,11 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset, char h5dimpath_name[MAX_DIM_NAME]; herr_t ret; + + /*zero out memory for h5sdsdim_allname and h5dimpath_name */ + h4toh5_ZeroMemory(h5sdsdim_allname,(MAX_VAR_DIMS*MAX_DIM_NAME)*sizeof(char)); + h4toh5_ZeroMemory(h5dimpath_name,MAX_DIM_NAME*sizeof(char)); + /*check whether the sds is created with unlimited dimension. */ if(SDgetchunkinfo(sds_id,&c_def_out, &c_flags)== FAIL) { @@ -781,7 +786,8 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset, /* here we should add some comments for fakedim0--name. It seems that hdf4(netcdf) will use unique fake dimension name, fakedim + unique number, so check_sdsdim will never be 1 if the dimension name is fake - name. Under this case, j will not increase if this dimension doesnot + name. Under this case, count_h5objref and count_h5attrname + will not increase if this dimension doesnot have dimensional scale data. That assures the object reference of sds is correct. */ -- cgit v0.12