summaryrefslogtreecommitdiffstats
path: root/src/H5Gdeprec.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-04-30 19:47:51 (GMT)
committerGitHub <noreply@github.com>2021-04-30 19:47:51 (GMT)
commit73bb382e9e77ca9847c09dff37b9e2338f26bbb8 (patch)
tree85e726e1aae576dc13ac76da36c92305c669ec92 /src/H5Gdeprec.c
parent7ab97037a0f64a583a6c7d4064d92a963cdfd843 (diff)
downloadhdf5-73bb382e9e77ca9847c09dff37b9e2338f26bbb8.zip
hdf5-73bb382e9e77ca9847c09dff37b9e2338f26bbb8.tar.gz
hdf5-73bb382e9e77ca9847c09dff37b9e2338f26bbb8.tar.bz2
Fixes crashes when size_hint > UINT32_MAX is passed to H5Gcreate1 (#611)
* Committing clang-format changes * Fixes incorrect size_hint handling in H5Gcreate1 * Updates the size hint type for group creation * Updates the RELEASE.txt note * Revert "Updates the RELEASE.txt note" This reverts commit 3df386acca806d652bbe2209f7c4503b30f068ff. * Reverts previous behavior to use a uint32_t struct field * Updates RELEASE.txt Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Gdeprec.c')
-rw-r--r--src/H5Gdeprec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 453796e..45065e8 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -141,10 +141,10 @@ H5G_map_obj_type(H5O_type_t obj_type)
* specified NAME. The group is opened for write access
* and it's object ID is returned.
*
- * The optional SIZE_HINT specifies how much file space to
- * reserve to store the names that will appear in this
- * group. If a non-positive value is supplied for the SIZE_HINT
- * then a default size is chosen.
+ * The SIZE_HINT parameter specifies how much file space to reserve
+ * to store the names that will appear in this group. This number
+ * must be less than or equal to UINT32_MAX. If zero is supplied
+ * for the SIZE_HINT then a default size is chosen.
*
* Note: Deprecated in favor of H5Gcreate2
*
@@ -174,6 +174,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
/* Check arguments */
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
+ if (size_hint > UINT32_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX")
/* Check if we need to create a non-standard GCPL */
if (size_hint > 0) {