diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-08-18 19:05:40 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-08-18 19:05:40 (GMT) |
commit | da6b493330592f2a44647221216a692f7bce692d (patch) | |
tree | 75c728254e469485fbd9fc34506326a4c563978f /src | |
parent | 8c0f8b1a959993a1f4b87e61c4b4e57b8f2b11e7 (diff) | |
download | hdf5-da6b493330592f2a44647221216a692f7bce692d.zip hdf5-da6b493330592f2a44647221216a692f7bce692d.tar.gz hdf5-da6b493330592f2a44647221216a692f7bce692d.tar.bz2 |
[svn-r9108] Purpose: Bug fix
Description: In H5O_fill_new_decode, it tries to read message size(-1) when
fill value is undefined for version 1. During UINT32DECODE, if the machine is
64-bit, a value 0x00000000ffffffff is returned, which is like a valid value.
Solution: If fill value is undefined, don't read the message size, simply
assign -1 to it.
Platforms tested: fuss - did h5committest for v1.6 already.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Ofill.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 57039bf..843cde1 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -146,8 +146,8 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, /* Whether fill value is defined */ mesg->fill_defined = *p++; - /* Check for version of fill value message */ - if(version==H5O_FILL_VERSION) { + /* Only decode fill value information if one is defined */ + if(mesg->fill_defined) { UINT32DECODE(p, mesg->size); if (mesg->size>0) { H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t); @@ -156,20 +156,8 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, HDmemcpy(mesg->buf, p, (size_t)mesg->size); } } /* end if */ - else { - /* Only decode fill value information if one is defined */ - if(mesg->fill_defined) { - UINT32DECODE(p, mesg->size); - if (mesg->size>0) { - H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t); - if (NULL==(mesg->buf=H5MM_malloc((size_t)mesg->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); - HDmemcpy(mesg->buf, p, (size_t)mesg->size); - } - } /* end if */ - else - mesg->size=(-1); - } /* end else */ + else + mesg->size=(-1); /* Set return value */ ret_value = (void*)mesg; |