From a2486eaf9427051a8413eb5415f5274229b04942 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 1 Oct 2026 20:26:47 -0400 Subject: [PATCH] Check elf_aux_info() return value in hasFastAes() Check the result of elf_aux_info() on FreeBSD and OpenBSD ARM and fall back to no AES support if the call fails, rather than relying on the output variable being left untouched. --- app/streaming/streamutils.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/streaming/streamutils.cpp b/app/streaming/streamutils.cpp index 9bd32f50..e768e348 100644 --- a/app/streaming/streamutils.cpp +++ b/app/streaming/streamutils.cpp @@ -222,12 +222,14 @@ bool StreamUtils::hasFastAes() // Everything that runs Catalina and later has AES-NI or ARMv8 crypto instructions return true; #elif (defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 4 - unsigned long hwcap2 = 0; - elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2)); + unsigned long hwcap2; + if (elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2)) != 0) + hwcap2 = 0; return (hwcap2 & HWCAP2_AES); #elif (defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 8 - unsigned long hwcap = 0; - elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); + unsigned long hwcap; + if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) != 0) + hwcap = 0; return (hwcap & HWCAP_AES); #elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 4 return getauxval(AT_HWCAP2) & HWCAP2_AES;