summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-02-27 04:16:13 (GMT)
committerlrknox <lrknox>2018-05-11 17:05:31 (GMT)
commit0a7128c0d5bd035288be7b02ca9cf9bba321aadd (patch)
treebaec80510450369bb86d08d0357d483abb50813f /src/H5T.c
parentfb55d82aa44309df76d4c3e6a8a3d5f2c2ac7792 (diff)
downloadhdf5-0a7128c0d5bd035288be7b02ca9cf9bba321aadd.zip
hdf5-0a7128c0d5bd035288be7b02ca9cf9bba321aadd.tar.gz
hdf5-0a7128c0d5bd035288be7b02ca9cf9bba321aadd.tar.bz2
Fix for HDFFV-10357 (CVE-2017-17508).
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 36b4c63..f4c10a5 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5174,6 +5174,11 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Check if the field changed size */
if(old_size != memb_type->shared->size) {
+
+ /* Fail if the old_size is zero */
+ if (0 == old_size)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero");
+
/* Adjust the size of the member */
dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size;