From f48b4e3b74a5f08e104f2d13e8a85d6a690c69a7 Mon Sep 17 00:00:00 2001 From: rainerjung Date: Tue, 13 Oct 2026 12:11:05 +0200 Subject: Fix wrong alignment in tho allocator used in quic_stream test. Wrong alignment observed on Solaris Sparc 10 (bus error). THO_ALLOC_HDR has size 20 and memory for structures gets allocated at addresses directly following a THO_ALLOC_HDR. Backport needed for the 4.1 branch. Fixes https://github.com/openssl/openssl/issues/33187 Reviewed-by: Eugene Syromiatnikov Reviewed-by: Nikola Pajkovsky Merge-date: Wed Oct 21 17:10:20 2026 Merged-from: https://github.com/openssl/openssl/pull/33204 --- test/quic_stream_test.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/quic_stream_test.c b/test/quic_stream_test.c index dbb666973d0..1da50a3ee53 100644 --- a/test/quic_stream_test.c +++ b/test/quic_stream_test.c @@ -2870,7 +2870,17 @@ static CRYPTO_malloc_fn malloc_save; static CRYPTO_realloc_fn realloc_save; static CRYPTO_free_fn free_save; -typedef struct tdc_alloc_hdr_st { +#if defined(__GNUC__) || defined(__clang__) +#define ALIGN_ALLOC_HDR __attribute((aligned(16))) +#else +#define ALIGN_ALLOC_HDR +#endif + +/* + * Increased alignment is needed, as tdc_malloc() custom allocator + * returns memory addresses directly following a TDC_ALLOC_HDR. + */ +typedef struct ALIGN_ALLOC_HDR tdc_alloc_hdr_st { size_t size; OSSL_LIST_MEMBER(tdc, struct tdc_alloc_hdr_st); } TDC_ALLOC_HDR; @@ -3156,7 +3166,11 @@ err: return ok; } -typedef struct tho_alloc_hdr_st { +/* + * Increased alignment is needed, as tho_malloc() custom allocator + * returns memory addresses directly following a THO_ALLOC_HDR. + */ +typedef struct ALIGN_ALLOC_HDR tho_alloc_hdr_st { size_t size; const char *file; int from_reas; -- cgit