From 1d20240e929407d78d2191279ccec9809b620981 Mon Sep 17 00:00:00 2001 From: Jellybin06 Date: Tue, 2 Jan 2024 23:58:05 +0900 Subject: [PATCH 1/2] found-cwe-416 --- .../source/vst/hosting/module_linux.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp index 404054c82851..bfdda6473e94 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp @@ -164,8 +164,10 @@ class LinuxModule : public Module if (!filesystem::is_directory (modulePath)) return {}; - stem.replace_extension (".so"); - modulePath /= stem; + auto newStem = stem; + newStem.replace_extension(".so"); + modulePath /= newStem; + return Optional (std::move (modulePath)); } @@ -323,11 +325,14 @@ Module::SnapshotList Module::getSnapshots (const std::string& modulePath) { filesystem::path p (png); auto filename = p.filename ().generic_string (); - auto uid = Snapshot::decodeUID (filename); + std::string decodedFilename = filename; + auto uid = Snapshot::decodeUID(decodedFilename); + if (!uid) continue; auto scaleFactor = 1.; - if (auto decodedScaleFactor = Snapshot::decodeScaleFactor (filename)) + std::string decodedFilename = filename; + if (auto decodedScaleFactor = Snapshot::decodeScaleFactor(decodedFilename)) scaleFactor = *decodedScaleFactor; Module::Snapshot::ImageDesc desc; @@ -366,4 +371,4 @@ Optional Module::getModuleInfoPath (const std::string& modulePath) //------------------------------------------------------------------------ } // Hosting -} // VST3 +} // VST3 \ No newline at end of file From c75d7ef4438299f211a64df1115f7f607f67f1ed Mon Sep 17 00:00:00 2001 From: Jellybin06 Date: Wed, 3 Jan 2024 00:04:30 +0900 Subject: [PATCH 2/2] cwe-416 --- .../public.sdk/source/vst/hosting/module_linux.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp b/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp index bfdda6473e94..bcf7f97a97fc 100644 --- a/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp +++ b/modules/juce_audio_processors/format_types/VST3_SDK/public.sdk/source/vst/hosting/module_linux.cpp @@ -325,14 +325,13 @@ Module::SnapshotList Module::getSnapshots (const std::string& modulePath) { filesystem::path p (png); auto filename = p.filename ().generic_string (); - std::string decodedFilename = filename; - auto uid = Snapshot::decodeUID(decodedFilename); + auto uid = Snapshot::decodeUID(filename); + if (!uid) continue; auto scaleFactor = 1.; - std::string decodedFilename = filename; - if (auto decodedScaleFactor = Snapshot::decodeScaleFactor(decodedFilename)) + if (auto decodedScaleFactor = Snapshot::decodeScaleFactor(filename)) scaleFactor = *decodedScaleFactor; Module::Snapshot::ImageDesc desc;