mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Catch negative indices in IParamValueQueue impl
This would cause crashes with the validator which created empty parameter queues, and many plugins try to `getPoint(numPoints() - 1)`.
This commit is contained in:
@@ -71,7 +71,8 @@ tresult PLUGIN_API YaParamValueQueue::getPoint(
|
||||
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
|
||||
int32& sampleOffset /*out*/,
|
||||
Steinberg::Vst::ParamValue& value /*out*/) {
|
||||
if (index < static_cast<int32>(queue_.size())) {
|
||||
// Indices are signed integers, fun
|
||||
if (index >= 0 && index < static_cast<int32>(queue_.size())) {
|
||||
sampleOffset = queue_[index].first;
|
||||
value = queue_[index].second;
|
||||
|
||||
|
||||
@@ -118,7 +118,8 @@ int32 PLUGIN_API YaPluginFactory3::countClasses() {
|
||||
|
||||
tresult PLUGIN_API YaPluginFactory3::getClassInfo(Steinberg::int32 index,
|
||||
Steinberg::PClassInfo* info) {
|
||||
if (index >= static_cast<int32>(arguments_.class_infos_1.size())) {
|
||||
if (index < 0 ||
|
||||
index >= static_cast<int32>(arguments_.class_infos_1.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
@@ -134,7 +135,8 @@ tresult PLUGIN_API YaPluginFactory3::getClassInfo(Steinberg::int32 index,
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory3::getClassInfo2(int32 index, Steinberg::PClassInfo2* info) {
|
||||
if (index >= static_cast<int32>(arguments_.class_infos_2.size())) {
|
||||
if (index < 0 ||
|
||||
index >= static_cast<int32>(arguments_.class_infos_2.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
@@ -151,7 +153,8 @@ YaPluginFactory3::getClassInfo2(int32 index, Steinberg::PClassInfo2* info) {
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory3::getClassInfoUnicode(int32 index,
|
||||
Steinberg::PClassInfoW* info) {
|
||||
if (index >= static_cast<int32>(arguments_.class_infos_unicode.size())) {
|
||||
if (index < 0 ||
|
||||
index >= static_cast<int32>(arguments_.class_infos_unicode.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user