From a2407a296423d385603a79c53311500f099c34ca Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 27 Jan 2024 17:25:52 +0300 Subject: [PATCH 1/3] nx_tzdb: check for unpacked directory Otherwise things get funny if the archive is downloaded, but the unpacking was interrupted. --- externals/nx_tzdb/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/nx_tzdb/CMakeLists.txt b/externals/nx_tzdb/CMakeLists.txt index 0fad24642..13723f175 100644 --- a/externals/nx_tzdb/CMakeLists.txt +++ b/externals/nx_tzdb/CMakeLists.txt @@ -32,7 +32,7 @@ set(NX_TZDB_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/${NX_TZDB_VERSION}.zip") set(NX_TZDB_ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/nx_tzdb") -if ((NOT CAN_BUILD_NX_TZDB OR YUZU_DOWNLOAD_TIME_ZONE_DATA) AND NOT EXISTS ${NX_TZDB_ARCHIVE}) +if ((NOT CAN_BUILD_NX_TZDB OR YUZU_DOWNLOAD_TIME_ZONE_DATA) AND NOT EXISTS ${NX_TZDB_ROMFS_DIR}) set(NX_TZDB_DOWNLOAD_URL "https://github.com/lat9nq/tzdb_to_nx/releases/download/${NX_TZDB_VERSION}/${NX_TZDB_VERSION}.zip") message(STATUS "Downloading time zone data from ${NX_TZDB_DOWNLOAD_URL}...") From 3065ab0fd861ce7f394425dd72baa16f29b4d09d Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 27 Jan 2024 17:28:04 +0300 Subject: [PATCH 2/3] nx_tzdb: add another safety assertion --- externals/nx_tzdb/NxTzdbCreateHeader.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/externals/nx_tzdb/NxTzdbCreateHeader.cmake b/externals/nx_tzdb/NxTzdbCreateHeader.cmake index 8c29e1167..95606d862 100644 --- a/externals/nx_tzdb/NxTzdbCreateHeader.cmake +++ b/externals/nx_tzdb/NxTzdbCreateHeader.cmake @@ -11,6 +11,10 @@ execute_process( WORKING_DIRECTORY ${ZONE_PATH} OUTPUT_VARIABLE FILE_LIST) +if (NOT FILE_LIST) + message(FATAL_ERROR "No timezone files found in directory ${ZONE_PATH}, did the download fail?") +endif() + set(DIRECTORY_NAME ${HEADER_NAME}) set(FILE_DATA "") From 8b4746558674123405c18df246b90784be28cc6b Mon Sep 17 00:00:00 2001 From: K900 Date: Sat, 27 Jan 2024 17:32:49 +0300 Subject: [PATCH 3/3] input: add a missing null pointer check There's a few other places where the result of GetAruidData is accessed without a null check, but I couldn't find a code path that hits those. --- .../resources/abstracted_pad/abstract_properties_handler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp b/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp index 4897a2784..36b630c7f 100644 --- a/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp +++ b/src/hid_core/resources/abstracted_pad/abstract_properties_handler.cpp @@ -137,7 +137,7 @@ void NpadAbstractPropertiesHandler::UpdateAllDeviceProperties() { const auto npad_index = NpadIdTypeToIndex(npad_id_type); for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) { auto* data = applet_resource_holder->applet_resource->GetAruidData(aruid_index); - if (!data->flag.is_assigned) { + if (data == nullptr || !data->flag.is_assigned) { continue; } auto& npad_entry = data->shared_memory_format->npad.npad_entry[npad_index];