From 26b009c0f4839b6ea9c89716613ed2033fe165d3 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 2 Apr 2022 16:41:52 -0700 Subject: [PATCH] Bug 798500 - FTBFS (tests failure) on armhf Ensure the transition_times are correctly aligned for their sizes before attempting to copy them into the transitions vector. --- libgnucash/engine/gnc-timezone.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libgnucash/engine/gnc-timezone.cpp b/libgnucash/engine/gnc-timezone.cpp index a150d619e9..06aedb2974 100644 --- a/libgnucash/engine/gnc-timezone.cpp +++ b/libgnucash/engine/gnc-timezone.cpp @@ -446,15 +446,23 @@ namespace IANAParser auto info_index = info_index_zero + index; if (transition_size == 4) { - transitions.push_back( - {*(endian_swap(reinterpret_cast(&fileblock[fb_index]))), - static_cast(fileblock[info_index])}); + int32_t transition_time; + // Ensure correct alignment for ARM. + memcpy(&transition_time, + endian_swap(reinterpret_cast(&fileblock[fb_index])), + sizeof(int32_t)); + auto info = static_cast(fileblock[info_index]); + transitions.push_back({transition_time, info}); } else { - transitions.push_back( - {*(endian_swap(reinterpret_cast(&fileblock[fb_index]))), - static_cast(fileblock[info_index])}); + int64_t transition_time; + // Ensure correct alignment for ARM. + memcpy(&transition_time, + endian_swap(reinterpret_cast(&fileblock[fb_index])), + sizeof(int64_t)); + auto info = static_cast(fileblock[info_index]); + transitions.push_back({transition_time, info}); } }