Commit f48b4e3b74 for openssl.org
commit f48b4e3b74a5f08e104f2d13e8a85d6a690c69a7
Author: rainerjung <rainer.jung@kippdata.de>
Date: Tue Oct 13 12:11:05 2026 +0200
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 <esyr@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Wed Oct 21 17:10:20 2026
Merged-from: https://github.com/openssl/openssl/pull/33204
diff --git a/test/quic_stream_test.c b/test/quic_stream_test.c
index dbb666973d..1da50a3ee5 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;