summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-03-05 18:38:20 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2018-03-05 18:38:20 (GMT)
commit3b0e80c1dcdf664f56829383aa3bc9e8ecc0f2c6 (patch)
tree38f2c82884f783f76bf31c1337dca3eb29b919a4
parenta30da017cc0c0d981d384afad2c074ad5a65d618 (diff)
parentce005900d6ad539cc7556ab225b771d24632f4f1 (diff)
downloadhdf5-3b0e80c1dcdf664f56829383aa3bc9e8ecc0f2c6.zip
hdf5-3b0e80c1dcdf664f56829383aa3bc9e8ecc0f2c6.tar.gz
hdf5-3b0e80c1dcdf664f56829383aa3bc9e8ecc0f2c6.tar.bz2
Merge pull request #911 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:hdffv_10357 to develop
* commit 'ce005900d6ad539cc7556ab225b771d24632f4f1': Fix for HDFFV-10357 (CVE-2017-17508).
-rw-r--r--release_docs/RELEASE.txt15
-rw-r--r--src/H5T.c5
2 files changed, 20 insertions, 0 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 4675423..480bb14 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -232,6 +232,21 @@ Bug Fixes since HDF5-1.10.1 release
(DER - 2017/11/21, HDFFV-10330)
+ - If an HDF5 file contains a malformed compound type which contains
+ a member of size zero, a division by zero error will occur while
+ processing the type.
+
+ This issue was reported to The HDF Group as issue #CVE-2017-17508.
+
+ NOTE: The HDF5 C library cannot produce such a file. This condition
+ should only occur in a corrupt (or deliberately altered) file
+ or a file created by third-party software.
+
+ Checking for zero before dividing fixes the problem. Instead of the
+ division by zero, the normal HDF5 error handling is invoked.
+
+ (DER - 2018/02/26, HDFFV-10357)
+
Configuration
-------------
- CMake
diff --git a/src/H5T.c b/src/H5T.c
index eca0132..ffa7bcb 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5211,6 +5211,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;