diff options
Diffstat (limited to 'src/H5Oefl.c')
-rw-r--r-- | src/H5Oefl.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/H5Oefl.c b/src/H5Oefl.c index c9369e5..ec33293 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -91,6 +91,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s H5O_efl_t *mesg = NULL; int i, version; const char *s = NULL; + const H5HL_t *heap; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_efl_decode, NULL); @@ -119,10 +120,19 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s /* Heap address */ H5F_addr_decode(f, &p, &(mesg->heap_addr)); + #ifndef NDEBUG assert (H5F_addr_defined(mesg->heap_addr)); - s = H5HL_peek (f, dxpl_id, mesg->heap_addr, 0); + + if (NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") + + s = H5HL_offset_into(f, heap, 0); + assert (s && !*s); + + if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") #endif /* Decode the file list */ @@ -132,9 +142,17 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s for (i=0; i<mesg->nused; i++) { /* Name */ H5F_DECODE_LENGTH (f, p, mesg->slot[i].name_offset); - s = H5HL_peek(f, dxpl_id, mesg->heap_addr, mesg->slot[i].name_offset); + + if (NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr))) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") + + s = H5HL_offset_into(f, heap, mesg->slot[i].name_offset); assert (s && *s); mesg->slot[i].name = H5MM_xstrdup (s); + assert(mesg->slot[i].name); + + if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") /* File offset */ H5F_DECODE_LENGTH (f, p, mesg->slot[i].offset); |