From 9e6d5b7aa634d5d49f1e2ab8ab6017492a7879b9 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Thu, 19 Dec 2024 19:35:24 +0000 Subject: [PATCH] quic: work around a GCC 11 compiler bug Fixes a bogus -Wstringop-overflow warning --- src/waltz/quic/fd_quic.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/waltz/quic/fd_quic.c b/src/waltz/quic/fd_quic.c index d56a6693e6..ba492d3951 100644 --- a/src/waltz/quic/fd_quic.c +++ b/src/waltz/quic/fd_quic.c @@ -2027,16 +2027,22 @@ fd_quic_lazy_ack_pkt( fd_quic_t * quic, return res; } +/* This thunk works around a compiler bug (bogus stringop-overflow warning) in GCC 11 */ +__attribute__((noinline)) static void +fd_quic_key_update_derive1( fd_quic_conn_t * conn ) { + fd_quic_key_update_derive( &conn->secrets, conn->new_keys ); +} + static void fd_quic_key_update_complete( fd_quic_conn_t * conn ) { /* Key updates are only possible for 1-RTT packets, which are appdata */ ulong const enc_level = fd_quic_enc_level_appdata_id; /* Update payload keys */ - memcpy( &conn->keys[enc_level][0].pkt_key, &conn->new_keys[0].pkt_key, FD_AES_128_KEY_SZ ); - memcpy( &conn->keys[enc_level][0].iv, &conn->new_keys[0].iv, FD_AES_GCM_IV_SZ ); - memcpy( &conn->keys[enc_level][1].pkt_key, &conn->new_keys[1].pkt_key, FD_AES_128_KEY_SZ ); - memcpy( &conn->keys[enc_level][1].iv, &conn->new_keys[1].iv, FD_AES_GCM_IV_SZ ); + memcpy( conn->keys[enc_level][0].pkt_key, conn->new_keys[0].pkt_key, FD_AES_128_KEY_SZ ); + memcpy( conn->keys[enc_level][0].iv, conn->new_keys[0].iv, FD_AES_GCM_IV_SZ ); + memcpy( conn->keys[enc_level][1].pkt_key, conn->new_keys[1].pkt_key, FD_AES_128_KEY_SZ ); + memcpy( conn->keys[enc_level][1].iv, conn->new_keys[1].iv, FD_AES_GCM_IV_SZ ); /* Update IVs */ memcpy( conn->secrets.secret[enc_level][0], conn->secrets.new_secret[0], FD_QUIC_SECRET_SZ ); @@ -2047,7 +2053,7 @@ fd_quic_key_update_complete( fd_quic_conn_t * conn ) { /* Wind up for next key phase update */ conn->key_phase = !conn->key_phase; conn->key_update = 0; - fd_quic_key_update_derive( &conn->secrets, conn->new_keys ); + fd_quic_key_update_derive1( conn ); FD_DEBUG( FD_LOG_DEBUG(( "key update completed" )); ) }