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 <jack@randombit.net>
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);
 

