From 2e242bfd2214ec9a804428763d0e158499dd04f5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 18 Oct 2004 22:31:14 -0500 Subject: [svn-r9434] Purpose: Bug fix Description: Fix core dump when flushing a file with a newly created attribute which hasn't had a value written to it still open. Solution: Write the attribute fill value when appropriate. Platforms tested: FreeBSd 4.10 (sleipnir) Linux 2.4 (verbena) Solaris 2.7 (arabica) --- release_docs/RELEASE.txt | 2 + src/H5Oattr.c | 5 +- test/tattr.c | 166 ++++++++++++++++++++++++++++------------------- 3 files changed, 107 insertions(+), 66 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6a3c101..17c9e53 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -68,6 +68,8 @@ Bug Fixes since HDF5-1.6.3 release Library ------- + - Fix segmentation fault when calling H5Fflush with an attribute that + hasn't had a value written to it open. QAK - 2004/10/18 - Back up supporting bitfield and time types in H5Tget_native_type. Leave it to future support. The function simply returns error message of "not support" for bitfield and time types. diff --git a/src/H5Oattr.c b/src/H5Oattr.c index f454b74..3bb9bd8 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -344,7 +344,10 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) p += attr->ds_size; /* Store attribute data */ - HDmemcpy(p,attr->data,attr->data_size); + if(attr->data) + HDmemcpy(p,attr->data,attr->data_size); + else + HDmemset(p,0,attr->data_size); done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/test/tattr.c b/test/tattr.c index bfb5daf..c303171 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -169,9 +169,8 @@ test_attr_basic_write(void) /* Verify values read in */ for(i=0; i