diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2009-09-25 18:11:40 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2009-09-25 18:11:40 (GMT) |
commit | a2faf5621f38ff5d745acbc254dfbded02664e28 (patch) | |
tree | 5d74903f1cd5abd103c444d8d6ca6b086763c8c8 /src/H5Pint.c | |
parent | 51d3e9b1730437a4f9718d71909d311174acdfa0 (diff) | |
download | hdf5-a2faf5621f38ff5d745acbc254dfbded02664e28.zip hdf5-a2faf5621f38ff5d745acbc254dfbded02664e28.tar.gz hdf5-a2faf5621f38ff5d745acbc254dfbded02664e28.tar.bz2 |
[svn-r17531] Purpose: Fix bug 1555
Description:
At several places in H5Pint.c properties were being compared using memcmp, not
using the registered "cmp" callback. This could cause memory checkers to
report uninitialized memory errors, and could conceivably cause runtime errors
if memcmp reported false equality (for example if a value pointed to by the
property changed).
The code has been changed to always use the cmp callback. Tests have been added that check this in all the places that previously used memcmp.
Tested: jam, linew, smirom (h5committest)
Diffstat (limited to 'src/H5Pint.c')
-rw-r--r-- | src/H5Pint.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/H5Pint.c b/src/H5Pint.c index 56f1929..364cab2 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -277,7 +277,7 @@ H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed"); /* Check if the property value changed */ - if(HDmemcmp(tmp_value,prop->value,prop->size)) { + if((prop->cmp)(tmp_value,prop->value,prop->size)) { /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property"); @@ -2264,7 +2264,7 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); } /* end if */ - if(HDmemcmp(tmp_value,prop->value,prop->size)) { + if((prop->cmp)(tmp_value,prop->value,prop->size)) { /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property"); @@ -2282,7 +2282,7 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) } /* end if */ /* No 'set' callback, just copy value */ else { - if(HDmemcmp(value,prop->value,prop->size)) { + if((prop->cmp)(value,prop->value,prop->size)) { /* Make a copy of the class's property */ if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property"); @@ -3614,7 +3614,7 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); } /* end if */ - if(HDmemcmp(tmp_value,prop->value,prop->size)) { + if((prop->cmp)(tmp_value,prop->value,prop->size)) { H5P_genprop_t *pcopy; /* Copy of property to insert into skip list */ /* Make a copy of the class's property */ |