Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/boost.git#8158d2d41c9b98b1bcfb02b524b7bbf85e320e6a
This commit is contained in:
DistroBaker 2020-11-20 22:03:30 +00:00
parent 6e9f03f731
commit 4deb382dad
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From daf4ef50c88c2b9a6bf2c40b537eebc202caad6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gonzalve?=
<sebastien.gonzalve@aliceadsl.fr>
Date: Sat, 14 Nov 2020 10:39:47 +0100
Subject: [PATCH] Do not try to access element when vector is empty
Trying to access tmp[0] causes a crash on Fedora when assertion on STL
are enabled.
/usr/include/c++/10/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; std::vector<_Tp, _Alloc>::reference = unsigned char&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
This patch just passes nullptr as pointer to getSortKey() when tmp size
is 0, preventing dereferencing elements in empty vector.
I guess that &tmp[0] should be optimized as 'no real access' when
disabling assertion, but actually leads to crash when assert are
enabled.
---
src/icu/collator.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/locale/src/icu/collator.cpp b/libs/locale/src/icu/collator.cpp
index 7f1ea6a..dc59e8c 100644
--- a/libs/locale/src/icu/collator.cpp
+++ b/libs/locale/src/icu/collator.cpp
@@ -93,7 +93,7 @@ namespace boost {
std::vector<uint8_t> tmp;
tmp.resize(str.length());
icu::Collator *collate = get_collator(level);
- int len = collate->getSortKey(str,&tmp[0],tmp.size());
+ int len = collate->getSortKey(str,tmp.empty()?nullptr:&tmp[0],tmp.size());
if(len > int(tmp.size())) {
tmp.resize(len);
collate->getSortKey(str,&tmp[0],tmp.size());
--
2.26.2

View File

@ -42,7 +42,7 @@ Name: boost
%global real_name boost
Summary: The free peer-reviewed portable C++ source libraries
Version: 1.73.0
Release: 10%{?dist}
Release: 11%{?dist}
License: Boost and MIT and Python
# Replace each . with _ in %%{version}
@ -171,6 +171,10 @@ Patch92: boost-1.73-mpi-vector-data.patch
# https://github.com/boostorg/python/issues/325
Patch93: boost-1.73-python3.10.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1899888
# https://github.com/boostorg/locale/issues/52
Patch94: boost-1.73-locale-empty-vector.patch
%bcond_with tests
%bcond_with docs_generated
@ -688,6 +692,7 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94 -p1
%build
# Dump the versions being used into the build logs.
@ -1298,6 +1303,9 @@ fi
%{_mandir}/man1/b2.1*
%changelog
* Fri Nov 20 2020 Jonathan Wakely <jwakely@redhat.com> - 1.73.0-11
- Patch Boost.Locale to not access empty vector (#1899888)
* Fri Nov 13 2020 Jonathan Wakely <jwakely@redhat.com> - 1.73.0-10
- Patch Boost.Python for Python 3.10 changes (#1896382)