From 6f1b4fc4fcc4dd1fefe6ffc56173d76964e601d6 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Sat, 8 Feb 2025 19:09:44 +0100 Subject: [PATCH 1/4] utils: Use u8path to fix possible string conversion crashes on Windows All other path operations in the code base already use u8path to ensure that the strings provided by libobs (which will either be ASCII or UTF-8 byte sequences) are correctly converted into UTF-16 strings. --- src/utils/Json.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/Json.cpp b/src/utils/Json.cpp index 68f05881..923020a4 100644 --- a/src/utils/Json.cpp +++ b/src/utils/Json.cpp @@ -178,7 +178,7 @@ json Utils::Json::ObsDataToJson(obs_data_t *d, bool includeDefault) bool Utils::Json::GetJsonFileContent(std::string fileName, json &content) { - std::ifstream f(fileName); + std::ifstream f(std::filesystem::u8path(fileName)); if (!f.is_open()) return false; @@ -195,9 +195,11 @@ bool Utils::Json::GetJsonFileContent(std::string fileName, json &content) bool Utils::Json::SetJsonFileContent(std::string fileName, const json &content, bool makeDirs) { + auto jsonFilePath = std::filesystem::u8path(fileName); + if (makeDirs) { + auto p = jsonFilePath.parent_path(); std::error_code ec; - auto p = std::filesystem::path(fileName).parent_path(); if (!ec && !std::filesystem::exists(p, ec)) std::filesystem::create_directories(p, ec); if (ec) { @@ -207,7 +209,7 @@ bool Utils::Json::SetJsonFileContent(std::string fileName, const json &content, } } - std::ofstream f(fileName); + std::ofstream f(jsonFilePath); if (!f.is_open()) { blog(LOG_ERROR, "[Utils::Json::SetJsonFileContent] Failed to open file `%s` for writing", fileName.c_str()); return false; From 63e04d20daf84391955580579e6576dfb373fa7f Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Fri, 28 Feb 2025 14:15:34 -0500 Subject: [PATCH 2/4] base: Update version to 5.5.5 Changes: - Fix possible crashes if config path has unicode characters --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32765964..f910d2d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16...3.25) -set(obs-websocket_VERSION 5.5.4) +set(obs-websocket_VERSION 5.5.5) set(OBS_WEBSOCKET_RPC_VERSION 1) include(cmake/obs-websocket-api.cmake) From 88a3ee4231bb9b033ac8ef0c35ab10026ff7f394 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Fri, 21 Mar 2025 15:50:50 -0400 Subject: [PATCH 3/4] eventhandler: Fix possible crash on OBS start in Studio Mode When OBS Studio is started in Studio Mode, if a scene collection was not successfully found and loaded, the OBS Frontend API would, prior to https://github.com/obsproject/obs-studio/commit/577e3504d59f0d8e488ada7a05295d1d8267f095, emit OBS_FRONTEND_EVENT_SCENE_CHANGED and OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED anyway. This would result in currentScene here being a nullptr, causing a crash. For completeness, check for nullptr here so that we cannot crash if obs_frontend_get_current_scene() returns a nullptr. (cherry picked from commit 05e13b1bf6b367e7b3eec5f7524e12a41f0212e0) --- src/eventhandler/EventHandler_Scenes.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/eventhandler/EventHandler_Scenes.cpp b/src/eventhandler/EventHandler_Scenes.cpp index 9dc22110..b8dcdf6e 100644 --- a/src/eventhandler/EventHandler_Scenes.cpp +++ b/src/eventhandler/EventHandler_Scenes.cpp @@ -109,6 +109,9 @@ void EventHandler::HandleCurrentProgramSceneChanged() { OBSSourceAutoRelease currentScene = obs_frontend_get_current_scene(); + if (!currentScene) + return; + json eventData; eventData["sceneName"] = obs_source_get_name(currentScene); eventData["sceneUuid"] = obs_source_get_uuid(currentScene); From c542622d7b6d41ce5875f54efdab1d4ac2967ef4 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Fri, 21 Mar 2025 15:51:15 -0400 Subject: [PATCH 4/4] base: Update version to 5.5.6 Changes: - Fix possible crash if OBS started in Studio Mode --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f910d2d8..f435efeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16...3.25) -set(obs-websocket_VERSION 5.5.5) +set(obs-websocket_VERSION 5.5.6) set(OBS_WEBSOCKET_RPC_VERSION 1) include(cmake/obs-websocket-api.cmake)