commit:     06541a13d6e2afd33d978ca1e9841de63ad41072
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 23 02:47:31 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 23 02:47:31 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06541a13

dev-libs/botan: fix tests w/ -D_GLIBCXX_ASSERTIONS

Test-only fix.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/botan/botan-3.6.1.ebuild                  |  3 +-
 .../botan-3.6.1-tests-glibcxx_assertions.patch     | 40 ++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/dev-libs/botan/botan-3.6.1.ebuild 
b/dev-libs/botan/botan-3.6.1.ebuild
index a74ebb175427..e47afaa7b00d 100644
--- a/dev-libs/botan/botan-3.6.1.ebuild
+++ b/dev-libs/botan/botan-3.6.1.ebuild
@@ -56,7 +56,8 @@ BDEPEND="
 # 
https://botan.randombit.net/handbook/packaging.html#minimize-distribution-patches
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-3.6.1-boost-1.87.patch
+       "${FILESDIR}"/${P}-boost-1.87.patch
+       "${FILESDIR}"/${P}-tests-glibcxx_assertions.patch
 )
 
 python_check_deps() {

diff --git a/dev-libs/botan/files/botan-3.6.1-tests-glibcxx_assertions.patch 
b/dev-libs/botan/files/botan-3.6.1-tests-glibcxx_assertions.patch
new file mode 100644
index 000000000000..204adbc15825
--- /dev/null
+++ b/dev-libs/botan/files/botan-3.6.1-tests-glibcxx_assertions.patch
@@ -0,0 +1,40 @@
+https://github.com/randombit/botan/issues/4491
+https://github.com/randombit/botan/commit/3e0cb45cc94764e3ff221ceb141421a83eb27aef
+
+From 3e0cb45cc94764e3ff221ceb141421a83eb27aef Mon Sep 17 00:00:00 2001
+From: Jack Lloyd <[email protected]>
+Date: Mon, 28 Oct 2024 18:13:52 -0400
+Subject: [PATCH] Workaround apparent libstdc++ bug in Ubuntu 24.04
+
+The iterator checks failed when we attempted to use first to extract
+ideal_granularity bytes out of dummy_buffer, but on testing it failed
+exactly when ideal_granularity was 256 bytes, the same size as
+dummy_buffer itself.
+
+Increase the size and add an assert that the buffer is large enough.
+---
+ src/tests/test_ffi.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp
+index 647e6ad10b..592435b142 100644
+--- a/src/tests/test_ffi.cpp
++++ b/src/tests/test_ffi.cpp
+@@ -1381,7 +1381,7 @@ class FFI_AEAD_Test final : public FFI_Test {
+             std::vector<uint8_t> ciphertext(ideal_granularity * pt_multiplier 
+ taglen);
+             TEST_FFI_OK(botan_rng_get, (rng, plaintext.data(), 
plaintext.size()));
+ 
+-            std::vector<uint8_t> dummy_buffer(256);
++            std::vector<uint8_t> dummy_buffer(1024);
+             TEST_FFI_OK(botan_rng_get, (rng, dummy_buffer.data(), 
dummy_buffer.size()));
+             std::vector<uint8_t> dummy_buffer_reference = dummy_buffer;
+ 
+@@ -1405,6 +1405,7 @@ class FFI_AEAD_Test final : public FFI_Test {
+                // input if there is no space in the output buffer. Even when
+                // the cipher is a mode that won't produce any output until the
+                // entire message is processed. Hence, give it some dummy 
buffer.
++               BOTAN_ASSERT_NOMSG(dummy_buffer.size() > ideal_granularity);
+                auto ct_chunk = (requires_entire_message) ? 
std::span(dummy_buffer).first(ideal_granularity)
+                                                          : 
ct_stuffer.first(ideal_granularity);
+ 
+

Reply via email to