hdf5/PPC64LE-Fix-long-double-handling.patch
Ana Guerrero f7f6dfb4d4 Accepting request 848496 from home:anag:branches:science
- Update to version 1.10.7
  * https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.6/src/hdf5-1.10.6-RELEASE.txt
  * https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.7/src/hdf5-1.10.7-RELEASE.txt
- Security bugs fixed: 
  * CVE-2018-13870: heap-based buffer over-read in the function 
    H5O_link_decode in H5Olink.c  (bsc#1101493)
  * CVE-2018-13869: memcpy parameter overlap in the function 
    H5O_link_decode in H5Olink.c (bsc#1101495)
  * CVE-2018-17438:  A SIGFPE signal is raised in the function 
    H5D__select_io() of H5Dselect.c in the HDF HDF5 through 1.10.3 
    library during an attempted parse of a crafted HDF file, 
    because of incorrect protection against division
    (bsc#1109570)
  * CVE-2018-17435: A heap-based buffer over-read in H5O_attr_decode() 
    in H5Oattr.c in the HDF HDF5 through 1.10.3 library allows 
    attackers to cause a denial of service via a crafted HDF5 file. 
    (bsc#1109567)
- Refresh patches

- Security bugs fixed: 
  * CVE-2018-17233: A SIGFPE signal is raised in the function 
  H5D__create_chunk_file_map_hyper. (bsc#1109166)
  * CVE-2018-17434: Memory leak in the H5O__chunk_deserialize() 
  function in H5Ocache.c (bsc#1109167)
  * CVE-2018-17437: A SIGFPE signal is raised in the function 
  H5D__chunk_set_info_real. (bsc#1109168)
- Security bugs fixed: 
  * CVE-2017-17505: NULL pointer dereference in the function
    H5O_pline_decode allowing for DoS via crafted file (bsc#1072087)
  * CVE-2017-17506: Out of bounds read in the function

OBS-URL: https://build.opensuse.org/request/show/848496
OBS-URL: https://build.opensuse.org/package/show/science/hdf5?expand=0&rev=139
2020-11-14 11:11:35 +00:00

92 lines
4.0 KiB
Diff

From: Egbert Eich <eich@suse.com>
Date: Tue Nov 7 14:16:53 2017 +0100
Subject: [PATCH]PPC64LE: Fix long double handling
Git-commit: ad6559a71b7ba3cacb4b56d4747db63f28a12f55
References:
Signed-off-by: Egbert Eich <eich@suse.com>
Signed-off-by: Egbert Eich <eich@suse.com>
---
hdf5-1.10.1/config/cmake/ConversionTests.c | 16 ++++++++++++++++
hdf5-1.10.1/test/dt_arith.c | 26 ++++++++++++++++++++++++--
2 files changed, 40 insertions(+), 2 deletions(-)
Index: hdf5-1.10.7/config/cmake/ConversionTests.c
===================================================================
--- hdf5-1.10.7.orig/config/cmake/ConversionTests.c
+++ hdf5-1.10.7/config/cmake/ConversionTests.c
@@ -34,6 +34,14 @@ int HDF_NO_UBSAN main(void)
unsigned char s2[8];
int ret = 1;
+#if defined __powerpc64__ && defined _LITTLE_ENDIAN
+ /* Don't bother checking on ppc64le, we know it'll work, and
+ that what hdf5 calls 'special algorithm' simply is
+ IBM ldouble 128 (i.e. two seperately scaled doubles).
+ The check below assumes big endian. */
+ ret = 0;
+#endif
+
if(sizeof(long double) == 16 && sizeof(long) == 8) {
/*make sure the long double type has 16 bytes in size and
* 11 bits of exponent. If it is,
@@ -157,6 +165,14 @@ int HDF_NO_UBSAN main(void)
unsigned char s[16];
int ret = 0;
+#if defined __powerpc64__ && defined _LITTLE_ENDIAN
+ /* Don't bother checking on ppc64le, we know it'll work, and
+ that what hdf5 calls 'special algorithm' simply is
+ IBM ldouble 128 (i.e. two seperately scaled doubles).
+ The check below assumes big endian. */
+ ret = 0;
+#endif
+
if(sizeof(long double) == 16) {
/*make sure the long double type is the same as the failing type
*which has 16 bytes in size and 11 bits of exponent. If it is,
Index: hdf5-1.10.7/test/dt_arith.c
===================================================================
--- hdf5-1.10.7.orig/test/dt_arith.c
+++ hdf5-1.10.7/test/dt_arith.c
@@ -3045,7 +3045,18 @@ test_conv_flt_1 (const char *name, int r
buf, saved, nelmts);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if(src_type == FLT_LDOUBLE) {
- INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size,
+ size_t mant_dig = LDBL_MANT_DIG;
+ if (mant_dig >= src_nbits) {
+ /* This happens for IBM long double in little endian.
+ The macro LDBL_MANT_DIG says 106 mantissa bits, but the
+ HDF5 detection code actually represents it as a normal 64bit
+ double (52 bit mantissa) with the upper double being
+ unspec bits (which is sort of okay as the testsuite
+ wouldn't deal with that format correctly anyway). So
+ override the mantissa size. */
+ mant_dig = 52;
+ }
+ INIT_FP_SPECIAL(src_size, src_nbits, sendian, mant_dig, dst_size,
buf, saved, nelmts);
#endif
} else
@@ -3705,7 +3716,18 @@ test_conv_int_fp(const char *name, int r
INIT_FP_DENORM(long double, LDBL_MANT_DIG, src_size, src_nbits, sendian, dst_size,
buf, saved, nelmts);
} else {
- INIT_FP_SPECIAL(src_size, src_nbits, sendian, LDBL_MANT_DIG, dst_size, buf, saved, nelmts);
+ size_t mant_dig = LDBL_MANT_DIG;
+ if (mant_dig >= src_nbits) {
+ /* This happens for IBM long double in little endian.
+ The macro LDBL_MANT_DIG says 106 mantissa bits, but the
+ HDF5 detection code actually represents it as a normal 64bit
+ double (52 bit mantissa) with the upper double being
+ unspec bits (which is sort of okay as the testsuite
+ wouldn't deal with that format correctly anyway). So
+ override the mantissa size. */
+ mant_dig = 52;
+ }
+ INIT_FP_SPECIAL(src_size, src_nbits, sendian, mant_dig, dst_size, buf, saved, nelmts);
}
#endif
} else