diff options
author | Peter Levine <plevine457@gmail.com> | 2018-01-07 21:48:58 -0500 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2018-01-09 11:10:06 -0500 |
commit | b6ff87f01454fa2c2525917e7d2ff2b0089ade02 (patch) | |
tree | 3b97717b2501616a40c14ef23d7df1e57acdc794 /dev-cpp | |
parent | dev-cpp/gtest: Support install of extra docs (diff) | |
download | gentoo-b6ff87f01454fa2c2525917e7d2ff2b0089ade02.tar.gz gentoo-b6ff87f01454fa2c2525917e7d2ff2b0089ade02.tar.bz2 gentoo-b6ff87f01454fa2c2525917e7d2ff2b0089ade02.zip |
dev-cpp/gtest: Fix double free error
Bug: https://bugs.gentoo.org/631698
Closes: https://github.com/gentoo/gentoo/pull/5605
Package-Manager: Portage-2.3.16, Repoman-2.3.6
Diffstat (limited to 'dev-cpp')
-rw-r--r-- | dev-cpp/gtest/files/gtest-1.8.0-fix-doublefree.patch | 98 | ||||
-rw-r--r-- | dev-cpp/gtest/gtest-1.7.0-r1.ebuild | 2 | ||||
-rw-r--r-- | dev-cpp/gtest/gtest-1.8.0-r1.ebuild | 68 | ||||
-rw-r--r-- | dev-cpp/gtest/gtest-1.8.0.ebuild | 2 | ||||
-rw-r--r-- | dev-cpp/gtest/gtest-9999.ebuild | 1 |
5 files changed, 169 insertions, 2 deletions
diff --git a/dev-cpp/gtest/files/gtest-1.8.0-fix-doublefree.patch b/dev-cpp/gtest/files/gtest-1.8.0-fix-doublefree.patch new file mode 100644 index 000000000000..40fa1f6668bc --- /dev/null +++ b/dev-cpp/gtest/files/gtest-1.8.0-fix-doublefree.patch @@ -0,0 +1,98 @@ +Bug: https://bugs.gentoo.org/631698 +Upstream PR: https://github.com/google/googletest/pull/1339 + +From 0663ce9024c9b78ddf6eb3fc1ceb45361ed91767 Mon Sep 17 00:00:00 2001 +From: Romain Geissler <romain.geissler@gmail.com> +Date: Sat, 2 Dec 2017 22:47:20 +0100 +Subject: [PATCH] Fix double free when building Gtest/GMock in shared libraries + and linking a test executable with both. + +--- + googlemock/CMakeLists.txt | 63 ++++++++++++++++++++++++++++++----------------- + 1 file changed, 40 insertions(+), 23 deletions(-) + +diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt +index 724fdd5f0..f7bad8afc 100644 +--- a/googlemock/CMakeLists.txt ++++ b/googlemock/CMakeLists.txt +@@ -86,16 +86,23 @@ endif() + # Google Mock libraries. We build them using more strict warnings than what + # are used for other targets, to ensure that Google Mock can be compiled by + # a user aggressive about warnings. +-cxx_library(gmock +- "${cxx_strict}" +- "${gtest_dir}/src/gtest-all.cc" +- src/gmock-all.cc) +- +-cxx_library(gmock_main +- "${cxx_strict}" +- "${gtest_dir}/src/gtest-all.cc" +- src/gmock-all.cc +- src/gmock_main.cc) ++if (MSVC) ++ cxx_library(gmock ++ "${cxx_strict}" ++ "${gtest_dir}/src/gtest-all.cc" ++ src/gmock-all.cc) ++ ++ cxx_library(gmock_main ++ "${cxx_strict}" ++ "${gtest_dir}/src/gtest-all.cc" ++ src/gmock-all.cc ++ src/gmock_main.cc) ++else() ++ cxx_library(gmock "${cxx_strict}" src/gmock-all.cc) ++ target_link_libraries(gmock gtest) ++ cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc) ++ target_link_libraries(gmock_main gmock) ++endif() + + # If the CMake version supports it, attach header directory information + # to the targets for when we are part of a parent build (ie being pulled +@@ -175,23 +182,33 @@ if (gmock_build_tests) + ############################################################ + # C++ tests built with non-standard compiler flags. + +- cxx_library(gmock_main_no_exception "${cxx_no_exception}" +- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) +- +- cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" +- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) ++ if (MSVC) ++ cxx_library(gmock_main_no_exception "${cxx_no_exception}" ++ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + +- if (NOT MSVC OR MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010. +- # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that +- # conflict with our own definitions. Therefore using our own tuple does not +- # work on those compilers. +- cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" ++ cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + +- cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" +- gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) ++ if (MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010. ++ # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that ++ # conflict with our own definitions. Therefore using our own tuple does not ++ # work on those compilers. ++ cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" ++ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) ++ ++ cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" ++ gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) ++ endif() ++ else() ++ cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc) ++ target_link_libraries(gmock_main_no_exception gmock) ++ ++ cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc) ++ target_link_libraries(gmock_main_no_rtti gmock) ++ ++ cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" src/gmock_main.cc) ++ target_link_libraries(gmock_main_use_own_tuple gmock) + endif() +- + cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" + gmock_main_no_exception test/gmock-more-actions_test.cc) + diff --git a/dev-cpp/gtest/gtest-1.7.0-r1.ebuild b/dev-cpp/gtest/gtest-1.7.0-r1.ebuild index ee90d10ca58f..f1185b2db0cc 100644 --- a/dev-cpp/gtest/gtest-1.7.0-r1.ebuild +++ b/dev-cpp/gtest/gtest-1.7.0-r1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI="5" diff --git a/dev-cpp/gtest/gtest-1.8.0-r1.ebuild b/dev-cpp/gtest/gtest-1.8.0-r1.ebuild new file mode 100644 index 000000000000..e824453822ea --- /dev/null +++ b/dev-cpp/gtest/gtest-1.8.0-r1.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Python is required for tests and some build tasks. +PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy ) + +inherit python-any-r1 cmake-multilib + +DESCRIPTION="Google C++ Testing Framework" +HOMEPAGE="https://github.com/google/googletest" +SRC_URI="https://github.com/google/googletest/archive/release-${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos" +IUSE="doc examples test" + +DEPEND="test? ( ${PYTHON_DEPS} )" +RDEPEND="!dev-cpp/gmock" + +PATCHES=( + "${FILESDIR}"/${PN}-9999-fix-py-tests.patch + "${FILESDIR}"/${PN}-9999-fix-gcc6-undefined-behavior.patch + "${FILESDIR}"/${PN}-1.8.0-multilib-strict.patch + "${FILESDIR}"/${PN}-1.8.0-increase-clone-stack-size.patch + "${FILESDIR}"/${PN}-1.8.0-fix-doublefree.patch +) + +S="${WORKDIR}"/googletest-release-${PV} + +pkg_setup() { + use test && python-any-r1_pkg_setup +} + +multilib_src_configure() { + local mycmakeargs=( + -DBUILD_GMOCK=ON + -DBUILD_GTEST=ON + -DLIB_INSTALL_DIR=$(get_libdir) + -Dgtest_build_samples=OFF + -Dgtest_disable_pthreads=OFF + -DBUILD_SHARED_LIBS=ON + + # tests + -Dgmock_build_tests=$(usex test) + -Dgtest_build_tests=$(usex test) + -DPYTHON_EXECUTABLE="${PYTHON}" + ) + cmake-utils_src_configure mycmakeargs +} + +multilib_src_install_all() { + einstalldocs + + if use doc; then + docinto googletest + dodoc -r googletest/docs/* + docinto googlemock + dodoc -r googlemock/docs/* + fi + + if use examples; then + docinto examples + dodoc googletest/samples/*.{cc,h} + fi +} diff --git a/dev-cpp/gtest/gtest-1.8.0.ebuild b/dev-cpp/gtest/gtest-1.8.0.ebuild index 1091001188ee..3dbd8e1a06d4 100644 --- a/dev-cpp/gtest/gtest-1.8.0.ebuild +++ b/dev-cpp/gtest/gtest-1.8.0.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI=6 diff --git a/dev-cpp/gtest/gtest-9999.ebuild b/dev-cpp/gtest/gtest-9999.ebuild index a2c14fe23fd6..06c94dbd49af 100644 --- a/dev-cpp/gtest/gtest-9999.ebuild +++ b/dev-cpp/gtest/gtest-9999.ebuild @@ -30,6 +30,7 @@ RDEPEND="!dev-cpp/gmock" PATCHES=( "${FILESDIR}"/${PN}-9999-fix-gcc6-undefined-behavior.patch "${FILESDIR}"/${PN}-1.8.0-increase-clone-stack-size.patch + "${FILESDIR}"/${PN}-1.8.0-fix-doublefree.patch ) pkg_setup() { |