From fa41643a7edc89f035ea63d024b68fb7dd585a15 Mon Sep 17 00:00:00 2001 From: Cajus Pollmeier Date: Thu, 14 Dec 2023 14:16:18 +0100 Subject: [PATCH] Fix CMake extraction of sub architecture test The length check is hard coded to the length of the string under test. As the STRINGS match only filters out non printable characters, we've no guarantee that the characters before the == position are printable or not. So _pos may be > 1 and then string length check will be broken. Replaced this by a pattern match to see whether there's something after the ":". Fixes: QTBUG-120125 Pick-to: 6.6 6.5 Change-Id: I24971b3bc83ea05841dae21667fbbae3416cfcf9 Reviewed-by: Joerg Bornemann (cherry picked from commit e7457ff171255148d92254316433d39ef1bd3d28) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtBaseConfigureTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake index b62eec84104..7713def6bf2 100644 --- a/cmake/QtBaseConfigureTests.cmake +++ b/cmake/QtBaseConfigureTests.cmake @@ -73,7 +73,7 @@ function(qt_run_config_test_architecture) string(SUBSTRING "${_line}" ${_pos} -1 _architecture) endif() string(FIND "${_line}" "==Qt=magic=Qt== Sub-architecture:" _pos) - if (_pos GREATER -1 AND ${lineLength} GREATER 33) + if (_pos GREATER -1 AND NOT _line MATCHES "Sub-architecture:$") math(EXPR _pos "${_pos}+34") string(SUBSTRING "${_line}" ${_pos} -1 _sub_architecture) string(REPLACE " " ";" _sub_architecture "${_sub_architecture}")