yabause: 1 CWE-312 defect, MOAD 0001/0002/0003/0005 CLEAN vita3k-0001: unit test added for pre-existing CWE-407 patch
55 lines
2.3 KiB
Diff
55 lines
2.3 KiB
Diff
# UNDF: UNDF-2026-XXXXXXXXX
|
|
--- a/vita3k/ngs/src/route.cpp
|
|
+++ b/vita3k/ngs/src/route.cpp
|
|
@@ -17,6 +17,8 @@
|
|
|
|
#include <ngs/system.h>
|
|
|
|
+#include <unordered_set>
|
|
+
|
|
#include <util/vector_utils.h>
|
|
|
|
namespace ngs {
|
|
@@ -28,7 +30,13 @@ bool deliver_data(const MemState &mem, const std::vector<Voice *> &voice_queue,
|
|
if (!patch || patch->output_sub_index == -1)
|
|
continue;
|
|
|
|
- if (!vector_utils::contains(voice_queue, patch->dest))
|
|
+ if (voice_queue_set.find(patch->dest) == voice_queue_set.end())
|
|
continue;
|
|
|
|
const std::lock_guard<std::mutex> guard(*patch->dest->voice_mutex);
|
|
--- a/vita3k/ngs/include/ngs/system.h
|
|
+++ b/vita3k/ngs/include/ngs/system.h
|
|
@@ -15,6 +15,8 @@
|
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
+#include <unordered_set>
|
|
+
|
|
#pragma once
|
|
|
|
#include <mem/ptr.h>
|
|
@@ -218,4 +220,4 @@ struct Rack;
|
|
|
|
-bool deliver_data(const MemState &mem, const std::vector<Voice *> &voice_queue, Voice *source, const uint8_t output_port,
|
|
+bool deliver_data(const MemState &mem, const std::vector<Voice *> &voice_queue, const std::unordered_set<Voice *> &voice_queue_set, Voice *source, const uint8_t output_port,
|
|
const VoiceProduct &data_to_deliver);
|
|
--- a/vita3k/ngs/src/scheduler.cpp
|
|
+++ b/vita3k/ngs/src/scheduler.cpp
|
|
@@ -120,10 +120,12 @@ void VoiceScheduler::update(KernelState &kern, const MemState &mem, const SceUI
|
|
// make a copy of the queue, this way we have no issue if it is modified in a callback
|
|
std::vector<ngs::Voice *> queue_copy = queue;
|
|
+ const std::unordered_set<ngs::Voice *> queue_set(queue_copy.begin(), queue_copy.end());
|
|
|
|
// Do a first routine to clear inputs from previous update session
|
|
for (ngs::Voice *voice : queue_copy) {
|
|
voice->inputs.reset_inputs();
|
|
}
|
|
|
|
@@ -160,7 +162,7 @@ void VoiceScheduler::update(KernelState &kern, const MemState &mem, const SceUI
|
|
for (size_t i = 0; i < voice->rack->vdef->output_count; i++) {
|
|
if (voice->products[i].data)
|
|
- deliver_data(mem, queue_copy, voice, static_cast<uint8_t>(i), voice->products[i]);
|
|
+ deliver_data(mem, queue_copy, queue_set, voice, static_cast<uint8_t>(i), voice->products[i]);
|
|
}
|