summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt4
-rw-r--r--src/H5Fio.c2
-rw-r--r--src/H5O.c5
-rw-r--r--test/links.c17
4 files changed, 27 insertions, 1 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 35854bf..1d17c4e 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -249,6 +249,10 @@ Bug Fixes since HDF5-1.8.0 release
Library
-------
+ - Retrieving a link's name by index in the case where the link is
+ external and the file that the link refers to doesn't exist will
+ now fail gracefully rather than cause a segmentation fault.
+ (MAM - 2010/11/17)
- Modified library to always cache symbol table information. Libraries
version 1.6.3 have a bug which causes them to require this
information for some operations. (NAF - 2010/09/21 - 1864)
diff --git a/src/H5Fio.c b/src/H5Fio.c
index 231c4c9..c8c75b2 100644
--- a/src/H5Fio.c
+++ b/src/H5Fio.c
@@ -102,6 +102,7 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size,
HDassert(f);
HDassert(f->shared);
HDassert(buf);
+ HDassert(H5F_addr_defined(addr));
/* Check for attempting I/O on 'temporary' file address */
if(H5F_addr_le(f->shared->tmp_addr, (addr + size)))
@@ -146,6 +147,7 @@ HDfprintf(stderr, "%s: write to addr = %a, size = %Zu\n", FUNC, addr, size);
HDassert(f->shared);
HDassert(f->intent & H5F_ACC_RDWR);
HDassert(buf);
+ HDassert(H5F_addr_defined(addr));
/* Check for attempting I/O on 'temporary' file address */
if(H5F_addr_le(f->shared->tmp_addr, (addr + size)))
diff --git a/src/H5O.c b/src/H5O.c
index c160d3e..02778de 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1662,7 +1662,10 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
/* check args */
HDassert(loc);
HDassert(loc->file);
- HDassert(H5F_addr_defined(loc->addr));
+
+ /* Check for valid address */
+ if(!H5F_addr_defined(loc->addr))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "address undefined")
/* Check for write access on the file */
file_intent = H5F_INTENT(loc->file);
diff --git a/test/links.c b/test/links.c
index e4aead6..c8ece99 100644
--- a/test/links.c
+++ b/test/links.c
@@ -2640,6 +2640,8 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group IDs */
+ hid_t rid = (-1); /* Root Group ID */
+ hid_t status = (-1); /* Status */
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
@@ -2672,6 +2674,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
/* Open first file */
if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Get root group ID */
+ if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR;
+
/* Open object through dangling file external link */
H5E_BEGIN_TRY {
gid = H5Gopen2(fid, "no_file", H5P_DEFAULT);
@@ -2692,6 +2697,18 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
goto error;
}
+ /* Try to get name of object by index through dangling file external link */
+ H5E_BEGIN_TRY {
+ status = H5Lget_name_by_idx(rid, "no_file", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 0, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if (status >= 0) {
+ H5_FAILED();
+ puts(" Retreiving name of object by index through dangling file external link should have failed.");
+ } /* end if */
+
+ /* Close root group */
+ if(H5Gclose(rid) < 0) TEST_ERROR
+
/* Close first file */
if(H5Fclose(fid) < 0) TEST_ERROR