Add patch for out-of-bounds vector access in Boost.MPI

This commit is contained in:
Jonathan Wakely 2019-02-14 15:24:04 +00:00
parent 8e32c40a85
commit 0f9795fc5c
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From dc708430bf5fd31d29da2e7e6b5fd20fe593e106 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@users.noreply.github.com>
Date: Thu, 14 Feb 2019 15:55:31 +0100
Subject: [PATCH] mpi::detail::c_data needs to check for empty vectors
If the standard library is configured to do range checks (-D _GLIBCXX_ASSERTIONS), accessing the zeroth element of a vector to get its address triggers an assertion.
---
include/boost/mpi/detail/antiques.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/boost/mpi/detail/antiques.hpp b/include/boost/mpi/detail/antiques.hpp
index 0bd235b2..93b8efe9 100644
--- a/include/boost/mpi/detail/antiques.hpp
+++ b/include/boost/mpi/detail/antiques.hpp
@@ -19,10 +19,10 @@ namespace detail {
// serve as an incentive to get rid of this when those compilers
// are dropped.
template <typename T, typename A>
- T* c_data(std::vector<T,A>& v) { return &(v[0]); }
+ T* c_data(std::vector<T,A>& v) { if (v.empty()) return NULL; return &(v[0]); }
template <typename T, typename A>
- T const* c_data(std::vector<T,A> const& v) { return &(v[0]); }
+ T const* c_data(std::vector<T,A> const& v) { if (v.empty()) return NULL; return &(v[0]); }
// Some old MPI implementation (OpenMPI 1.6 for example) have non
// conforming API w.r.t. constness.

View File

@ -45,7 +45,7 @@ Summary: The free peer-reviewed portable C++ source libraries
Version: 1.69.0
%global version_enc 1_69_0
%global version_suffix 169
Release: 5%{?dist}
Release: 6%{?dist}
License: Boost and MIT and Python
%global toplev_dirname %{real_name}_%{version_enc}
@ -147,6 +147,9 @@ Patch83: boost-1.66.0-bjam-build-flags.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1673669
Patch84: boost-1.69-random.patch
# https://github.com/boostorg/mpi/pull/81
Patch85: boost-1.69-mpi-c_data.patch
%bcond_with tests
%bcond_with docs_generated
@ -755,6 +758,7 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x
%patch82 -p1
%patch83 -p1
%patch84 -p2
%patch85 -p2
%build
# Dump the versions being used into the build logs.
@ -1477,6 +1481,9 @@ fi
%{_mandir}/man1/bjam.1*
%changelog
* Thu Feb 14 2019 Jonathan Wakely <jwakely@redhat.com> - 1.69.0-6
- Add patch for out-of-bounds vector access in Boost.MPI
* Thu Feb 14 2019 Orion Poplawski <orion@nwra.com> - 1.69.0-5
- Rebuild for openmpi 3.1.3