From 5c4a0e07d3976b8dbabe0902eeb8231f6b712948 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 7 Dec 2017 14:37:10 +0000 Subject: [PATCH] Patch to fix #1516837 --- boost-1.64.0-icl-undefined-shift.patch | 28 ++++++++++++++++++++++++++ boost.spec | 10 ++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 boost-1.64.0-icl-undefined-shift.patch diff --git a/boost-1.64.0-icl-undefined-shift.patch b/boost-1.64.0-icl-undefined-shift.patch new file mode 100644 index 0000000..88441a1 --- /dev/null +++ b/boost-1.64.0-icl-undefined-shift.patch @@ -0,0 +1,28 @@ +From 9687dea689e58cd1f67440fa529cb5c9692e9858 Mon Sep 17 00:00:00 2001 +From: Avi Kivity +Date: Sun, 2 Jul 2017 12:56:35 +0300 +Subject: [PATCH] Fix undefined behavior in interval_bounds::reverse_right() + +The ~ operator converts _bits from unsigned char to int, and makes it +negative to boot. Shifting left a negative number is undefined behavior. + +Cast it back to unsigned char to prevent undefined behavior. +--- + include/boost/icl/interval_bounds.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/boost/icl/interval_bounds.hpp b/include/boost/icl/interval_bounds.hpp +index edf16d0..f917cb6 100644 +--- a/include/boost/icl/interval_bounds.hpp ++++ b/include/boost/icl/interval_bounds.hpp +@@ -41,8 +41,8 @@ class interval_bounds + interval_bounds all ()const { return interval_bounds(_bits & _all ); } + interval_bounds left ()const { return interval_bounds(_bits & _left ); } + interval_bounds right()const { return interval_bounds(_bits & _right); } +- interval_bounds reverse_left ()const { return interval_bounds((~_bits>>1) & _right); } +- interval_bounds reverse_right()const { return interval_bounds((~_bits<<1) & _left ); } ++ interval_bounds reverse_left ()const { return interval_bounds((bound_type(~_bits)>>1) & _right); } ++ interval_bounds reverse_right()const { return interval_bounds((bound_type(~_bits)<<1) & _left ); } + + bound_type bits()const{ return _bits; } + diff --git a/boost.spec b/boost.spec index 6a4fc93..7d84acc 100644 --- a/boost.spec +++ b/boost.spec @@ -35,7 +35,7 @@ Name: boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.64.0 %global version_enc 1_64_0 -Release: 5%{?dist} +Release: 6%{?dist} License: Boost and MIT and Python %global toplev_dirname %{name}_%{version_enc} @@ -144,6 +144,10 @@ Patch85: boost-1.64.0-serialization-make_array.patch # https://github.com/boostorg/icl/pull/9 Patch86: boost-1.64.0-icl-ttp-matching.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1516837 +# https://github.com/boostorg/icl/pull/11 +Patch87: boost-1.64.0-icl-undefined-shift.patch + %bcond_with tests %bcond_with docs_generated @@ -764,6 +768,7 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x %patch84 -p2 %patch85 -p2 %patch86 -p2 +%patch87 -p2 # At least python2_version needs to be a macro so that it's visible in # %%install as well. @@ -1553,6 +1558,9 @@ fi %{_mandir}/man1/bjam.1* %changelog +* Thu Dec 07 2017 Jonathan Wakely - 1.64.0-6 +- Patch to fix #1516837 + * Thu Nov 30 2017 Pete Walter - 1.64.0-5 - Rebuild for ICU 60.1