13
0

Fix OSC observer heap buffer-overflow

OSCCueObserver::send_init may populate a sparse map, rather
than a contiguously indexed vector
This commit is contained in:
Robin Gareus 2024-10-23 01:10:11 +02:00
parent 43961e2d86
commit 2816c85324
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ OSCCueObserver::refresh_strip (std::shared_ptr<ARDOUR::Stripable> new_strip, Sor
send_change_message (X_("/cue/mute"), 0, _strip->mute_control());
gain_timeout.push_back (0);
_last_gain.push_back (-1.0);
_last_gain[0] = -1; // unused
_strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, std::bind (&OSCCueObserver::send_gain_message, this, 0, _strip->gain_control(), false), OSC::instance());
send_gain_message (0, _strip->gain_control(), true);
@ -162,7 +162,7 @@ OSCCueObserver::send_init()
if (send->gain_control()) {
gain_timeout.push_back (0);
_last_gain.push_back (-1.0);
_last_gain[i + 1] = -1.0;
send->gain_control()->Changed.connect (send_connections, MISSING_INVALIDATOR, std::bind (&OSCCueObserver::send_gain_message, this, i + 1, send->gain_control(), false), OSC::instance());
send_gain_message (i + 1, send->gain_control(), true);
}

View File

@ -61,7 +61,7 @@ class OSCCueObserver
float _last_signal;
std::vector<uint32_t> gain_timeout;
bool tick_enable;
std::vector<float> _last_gain;
std::map<uint32_t,float> _last_gain;
void name_changed (const PBD::PropertyChange& what_changed, uint32_t id);
void send_change_message (std::string path, uint32_t id, std::shared_ptr<PBD::Controllable> controllable);