HDFFV-10571: Minor change - adding the error check right after decoding of chunk dimension for safeguard.

This commit is contained in:
Songyu Lu
2018-11-15 14:57:26 -06:00
parent 1d89a55590
commit c132cb5565
2 changed files with 10 additions and 5 deletions

View File

@@ -243,9 +243,14 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));
/* Chunk dimensions */
for(u = 0; u < mesg->u.chunk.ndims; u++)
for(u = 0; u < mesg->u.chunk.ndims; u++) {
UINT32DECODE(p, mesg->u.chunk.dim[u]);
/* Just in case that something goes very wrong, such as file corruption. */
if(mesg->u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u", u, mesg->u.chunk.dim[u])
}
/* Compute chunk size */
for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
mesg->u.chunk.size *= mesg->u.chunk.dim[u];