summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-11-12 17:22:10 (GMT)
committerGitHub <noreply@github.com>2020-11-12 17:22:10 (GMT)
commitfa40c6c59af5d9aabd4b478cd02f8a9f7ebf7922 (patch)
tree75c00aea365eda20d91a2f1f90b2fa7e573ec4b9 /src
parentcfb82afb80dca259ac2cf96bf24a941d27869a52 (diff)
parent9cde5c52b8183e9899a42fe161556a3969095fb1 (diff)
downloadhdf5-fa40c6c59af5d9aabd4b478cd02f8a9f7ebf7922.zip
hdf5-fa40c6c59af5d9aabd4b478cd02f8a9f7ebf7922.tar.gz
hdf5-fa40c6c59af5d9aabd4b478cd02f8a9f7ebf7922.tar.bz2
Merge pull request #60 from bmribler/develop
Fix HDFFV-10590
Diffstat (limited to 'src')
-rw-r--r--src/H5Osdspace.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index b34eb76..83702eb 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -138,8 +138,11 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN
flags = *p++;
/* Get or determine the type of the extent */
- if (version >= H5O_SDSPACE_VERSION_2)
+ if (version >= H5O_SDSPACE_VERSION_2) {
sdim->type = (H5S_class_t)*p++;
+ if (sdim->type != H5S_SIMPLE && sdim->rank > 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid rank for scalar or NULL dataspace")
+ } /* end if */
else {
/* Set the dataspace type to be simple or scalar as appropriate */
if (sdim->rank > 0)
@@ -248,13 +251,15 @@ H5O__sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg)
*p++ = 0; /*reserved*/
} /* end else */
- /* Current & maximum dimensions */
- if (sdim->rank > 0) {
- for (u = 0; u < sdim->rank; u++)
- H5F_ENCODE_LENGTH(f, p, sdim->size[u]);
- if (flags & H5S_VALID_MAX) {
+ /* Encode dataspace dimensions for simple dataspaces */
+ if (H5S_SIMPLE == sdim->type) {
+ /* Encode current & maximum dimensions */
+ if (sdim->rank > 0) {
for (u = 0; u < sdim->rank; u++)
- H5F_ENCODE_LENGTH(f, p, sdim->max[u]);
+ H5F_ENCODE_LENGTH(f, p, sdim->size[u]);
+ if (flags & H5S_VALID_MAX)
+ for (u = 0; u < sdim->rank; u++)
+ H5F_ENCODE_LENGTH(f, p, sdim->max[u]);
} /* end if */
} /* end if */