summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-08-04 21:45:40 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-08-04 21:45:40 (GMT)
commit46f8c941d7394d28befc660a7ab5532fa37a8e0f (patch)
tree046ff2e42299530fd844ac15c9ef49d19b85b25e /tools/src
parenta6d5bf1a86250cc660cd1ed420eeda6940792be5 (diff)
downloadhdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.zip
hdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.tar.gz
hdf5-46f8c941d7394d28befc660a7ab5532fa37a8e0f.tar.bz2
HDFFV-10188 error on NULL dataspace
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5dump/h5dump_xml.c38
-rw-r--r--tools/src/h5ls/h5ls.c62
2 files changed, 53 insertions, 47 deletions
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 49d4f96..d731013 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -1959,28 +1959,32 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
H5Tclose(type);
space = H5Aget_space(obj_id);
+ if(space == H5S_NULL || space == H5S_NO_CLASS) {
+ status = SUCCEED;
+ }
+ else {
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ for (i = 0; i < ndims; i++)
+ nelmts *= size[i];
- for (i = 0; i < ndims; i++)
- nelmts *= size[i];
+ buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
+ HDassert(buf);
- buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
- HDassert(buf);
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
+ h5tools_context_t datactx;
+ HDmemset(&datactx, 0, sizeof(datactx));
+ datactx.need_prefix = TRUE;
+ datactx.indent_level = ctx.indent_level;
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ }
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- if (H5Aread(obj_id, p_type, buf) >= 0) {
- h5tools_context_t datactx;
- HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
- datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ HDfree(buf);
}
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
-
- HDfree(buf);
H5Tclose(p_type);
H5Sclose(space);
H5Tclose(type);
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 8c18794..a181186 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -1617,38 +1617,40 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
info = &outputformat;
- if(hexdump_g)
- p_type = H5Tcopy(type);
- else
- p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
-
- if(p_type >= 0) {
- /* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
-
- /* Check if we have VL data in the dataset's datatype */
- if (h5tools_detect_vlen(p_type) == TRUE)
- vl_data = TRUE;
-
- temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
- HDassert(temp_need == (hsize_t)((size_t)temp_need));
- need = (size_t)temp_need;
- buf = HDmalloc(need);
- HDassert(buf);
- if(H5Aread(attr, p_type, buf) >= 0) {
- ctx.need_prefix = TRUE;
- ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
- h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
- }
+ if(space_type != H5S_NULL && space_type != H5S_NO_CLASS) {
+ if(hexdump_g)
+ p_type = H5Tcopy(type);
+ else
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
+
+ if(p_type >= 0) {
+ /* VL data special information */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5tools_detect_vlen(p_type) == TRUE)
+ vl_data = TRUE;
+
+ temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
+ HDassert(temp_need == (hsize_t)((size_t)temp_need));
+ need = (size_t)temp_need;
+ buf = HDmalloc(need);
+ HDassert(buf);
+ if(H5Aread(attr, p_type, buf) >= 0) {
+ ctx.need_prefix = TRUE;
+ ctx.indent_level = 2;
+ ctx.cur_column = (size_t)curr_pos;
+ h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
+ }
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- HDfree(buf);
- H5Tclose(p_type);
- } /* end if */
+ HDfree(buf);
+ H5Tclose(p_type);
+ } /* end if */
+ }
H5Sclose(space);
H5Tclose(type);