summaryrefslogtreecommitdiffstats
path: root/src/H5Fsuper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-09-08 21:16:31 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-09-08 21:16:31 (GMT)
commitd5c362618144381b3d2cb8030b6cd75d75bbe1bf (patch)
tree0a84d9afaa69572fe2efb9fd5511fb19959f26a4 /src/H5Fsuper.c
parentef70e5799952bc217d1c7e0bf300257a3d87f8ef (diff)
downloadhdf5-d5c362618144381b3d2cb8030b6cd75d75bbe1bf.zip
hdf5-d5c362618144381b3d2cb8030b6cd75d75bbe1bf.tar.gz
hdf5-d5c362618144381b3d2cb8030b6cd75d75bbe1bf.tar.bz2
[svn-r17460] Description:
Bring r17459 from trunk to v1.8 branch: Correct bad interaction between non-zero userblocks with non-zero alignments. Also add some additional range checking and tests for invalid userblock sizes. Tested on: FreeBSD/32 6.3 (duty) in debug mode (h5committested on trunk)
Diffstat (limited to 'src/H5Fsuper.c')
-rw-r--r--src/H5Fsuper.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 3be8069..f26d93f 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -419,6 +419,14 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get userblock size")
+ /* Sanity check the userblock size vs. the file's allocation alignment */
+ if(userblock_size > 0) {
+ if(userblock_size < f->shared->alignment)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment")
+ if(0 != (userblock_size % f->shared->alignment))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be an integral multiple of file object alignment")
+ } /* end if */
+
sblock->base_addr = userblock_size;
sblock->status_flags = 0;