From 13ef84ebfcb112ae71e02bb725a661732079409e Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 2 Aug 2024 17:16:49 +0000 Subject: [PATCH] hs_valid_platform: Fix check for SSE4.2 Vectorscan requires SSE4.2 as a minimum on x86_64. For Hyperscan this used to be SSSE3. Applications that use the library call hs_valid_platform() to check if the CPU fulfils this minimum requirement. However, when Vectorscan upgraded to SSE4.2, the check was not updated. This leads to the library trying to execute instructions that are not supported, resulting in the application to crash. This might not have been noticed as the CPUs that do not support SSE4.2 are rather old and unlikely to run any load where performance is an issue. However, I believe that the library should not let the application crash. Signed-off-by: Michael Tremer --- src/hs_valid_platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hs_valid_platform.c b/src/hs_valid_platform.c index b1d44ff4..4ab42df3 100644 --- a/src/hs_valid_platform.c +++ b/src/hs_valid_platform.c @@ -40,10 +40,10 @@ HS_PUBLIC_API hs_error_t HS_CDECL hs_valid_platform(void) { - /* Hyperscan requires SSSE3, anything else is a bonus */ + /* Vectorscan requires SSE4.2, anything else is a bonus */ #if !defined(VS_SIMDE_BACKEND) && (defined(ARCH_IA32) || defined(ARCH_X86_64)) // cppcheck-suppress knownConditionTrueFalse - if (check_ssse3()) { + if (check_sse42()) { return HS_SUCCESS; } else { return HS_ARCH_ERROR;