summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-02-24 18:45:25 +1100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-24 13:02:35 +0000
commit3d1a007d9544522c63d864b7d45b9276bd1088e5 (patch)
tree2c7ccf6156d2e55f6797a8f0c37de6b5af22b38c /cmake
parent2e00c7996a5e9770d6c0f0951a45925daf04a81e (diff)
CMake: Prevent qt_remove_args() from accessing out-of-range list index
Change-Id: Ie9c5f0551722c7d3fb11879b209c11ce3d7ccd6d Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 10b3681c72491cacf9ccf515fa2cbdf2ef131ff9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtCMakeHelpers.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmake/QtCMakeHelpers.cmake b/cmake/QtCMakeHelpers.cmake
index b6acde5f55..93513d4369 100644
--- a/cmake/QtCMakeHelpers.cmake
+++ b/cmake/QtCMakeHelpers.cmake
@@ -131,6 +131,10 @@ function(qt_remove_args out_var)
# remove arg
list(REMOVE_AT result ${find_result})
list(LENGTH result result_len)
+ if(find_result EQUAL result_len)
+ # We removed the last argument, could have been an option keyword
+ continue()
+ endif()
list(GET result ${find_result} arg_current)
# remove values until we hit another arg or the end of the list
while(NOT ${arg_current} IN_LIST arg_ALL_ARGS AND find_result LESS result_len)