This commit is contained in:
Jonathan Wakely 2017-12-07 14:37:10 +00:00
parent 9497c27f10
commit 5c4a0e07d3
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 9687dea689e58cd1f67440fa529cb5c9692e9858 Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@scylladb.com>
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; }

View File

@ -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 <jwakely@redhat.com> - 1.64.0-6
- Patch to fix #1516837
* Thu Nov 30 2017 Pete Walter <pwalter@fedoraproject.org> - 1.64.0-5
- Rebuild for ICU 60.1