summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-01-15 17:22:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-01-15 17:22:15 (GMT)
commite5dac2010c173cab81b70b2ba0e9ba03d2b94b91 (patch)
tree289b1d1bcf34918c245859fe8d4e54bcdb13ead0
parente36046999f277cc7330c4d7ca621cf51d75d2650 (diff)
downloadhdf5-e5dac2010c173cab81b70b2ba0e9ba03d2b94b91.zip
hdf5-e5dac2010c173cab81b70b2ba0e9ba03d2b94b91.tar.gz
hdf5-e5dac2010c173cab81b70b2ba0e9ba03d2b94b91.tar.bz2
[svn-r14418] Description:
Handled truncated files better, when the truncation falls in decoding a local heap. Tested on: Mac OS X/32 10.5.1 (amazon)
-rw-r--r--src/H5HL.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index 41a361f..76775f5 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -284,9 +284,12 @@ H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
if (!heap->freelist) heap->freelist = fl;
p = heap->chunk + sizeof_hdr + free_block;
+
H5F_DECODE_LENGTH(f, p, free_block);
- H5F_DECODE_LENGTH(f, p, fl->size);
+ if(free_block == 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "free block size is zero?");
+ H5F_DECODE_LENGTH(f, p, fl->size);
if (fl->offset + fl->size > heap->disk_alloc)
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list");
}