Properties not being compared with H5P_prp_compare_func_t

I'm getting "uninitialised memory" errors from within H5P_set because HDF5 is using memcmp on structures with padding (e.g. H5O_fill_t). I believe it should be using the property value comparison function where registered with H5P_register2.

I've attached a patch against 1.8.2 which seems to prevent these warnings for this limited context, but would like a developer to confirm whether there are any other instances of memcmp being used on padded structs. There certainly are a lot of HDmemcpy calls....

Regards,
Simon

H5Pint.c.patch (2.15 KB)

Simon,

Thank you very much for the patch. We greatly appreciate it.

The bug was added to our Bugzilla database. It will be reviewed, prioritized and ultimately face extinction.

Thanks again!

Elena

···

On Apr 23, 2009, at 8:20 AM, Number Cruncher wrote:

I'm getting "uninitialised memory" errors from within H5P_set because HDF5 is using memcmp on structures with padding (e.g. H5O_fill_t). I believe it should be using the property value comparison function where registered with H5P_register2.

I've attached a patch against 1.8.2 which seems to prevent these warnings for this limited context, but would like a developer to confirm whether there are any other instances of memcmp being used on padded structs. There certainly are a lot of HDmemcpy calls....

Regards,
Simon

Index: H5Pint.c

--- H5Pint.c (original)
+++ H5Pint.c (working copy)
@@ -294,7 +294,7 @@
        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");
@@ -2281,7 +2281,7 @@
                            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");
@@ -2299,7 +2299,7 @@
                    } /* 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");
@@ -3631,7 +3631,7 @@
                            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 */

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.