From 5b4f92ca79b07cf220209b88164a0763d7a0c489 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 5 Jun 2019 15:43:55 -0400 Subject: [PATCH 1/3] yuzu/CMakeLists: Disable implicit type narrowing in connect() calls Prevents hard-to-diagnose bugs from potentially occurring and requires any type narrowing to be explicitly performed by our code. --- src/yuzu/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 3ea7b55d0d..ec969a9a74 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -159,6 +159,9 @@ target_compile_definitions(yuzu PRIVATE # Disable implicit conversions from/to C strings -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII + + # Disable implicit type narrowing in signal/slot connect() calls. + -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT ) if (YUZU_ENABLE_COMPATIBILITY_REPORTING) From 12b32a058b631871548135eb56fa49e150b5ef20 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 5 Jun 2019 15:47:42 -0400 Subject: [PATCH 2/3] yuzu/CMakeLists: Disable unsafe overloads of QProcess' start() function Other overloads of start() are considerably much safer to use if we ever need this in the future and need to pass arguments to the program, given it contains separate parameters for the program path and the arguments themselves, whereas this unsafe overload contains both as a single string. Given the alternatives are much safer, we can disable this. --- src/yuzu/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index ec969a9a74..37394be377 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -162,6 +162,9 @@ target_compile_definitions(yuzu PRIVATE # Disable implicit type narrowing in signal/slot connect() calls. -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT + + # Disable unsafe overloads of QProcess' start() function. + -DQT_NO_PROCESS_COMBINED_ARGUMENT_START ) if (YUZU_ENABLE_COMPATIBILITY_REPORTING) From 3a5708eeaa02b3413f56168210912c5742c8127a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 5 Jun 2019 16:05:34 -0400 Subject: [PATCH 3/3] yuzu/CMakeLists: Disable implicit QString->QUrl conversions Enforces the use of the proper URL resolution functions. e.g. url = some_local_path_string; should actually be: url = QUrl::fromLocalPath(some_local_path_string); etc. This makes it harder to cause bugs when operating with both strings and URLs at the same time. --- src/yuzu/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 37394be377..3dc0e47d06 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -165,6 +165,9 @@ target_compile_definitions(yuzu PRIVATE # Disable unsafe overloads of QProcess' start() function. -DQT_NO_PROCESS_COMBINED_ARGUMENT_START + + # Disable implicit QString->QUrl conversions to enforce use of proper resolving functions. + -DQT_NO_URL_CAST_FROM_STRING ) if (YUZU_ENABLE_COMPATIBILITY_REPORTING)