13
0

Fixed buffer index overrun in connect_and_run()

git-svn-id: svn://localhost/trunk/ardour2@318 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2006-02-11 14:45:27 +00:00
parent cf0da62ff0
commit aa554c5d73
2 changed files with 4 additions and 4 deletions

View File

@ -609,14 +609,14 @@ LadspaPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, int32_t& i
while (port_index < parameter_count()) {
if (LADSPA_IS_PORT_AUDIO (port_descriptor(port_index))) {
if (LADSPA_IS_PORT_INPUT (port_descriptor(port_index))) {
connect_port (port_index, bufs[min((uint32_t) in_index,nbufs)] + offset);
connect_port (port_index, bufs[min((uint32_t) in_index,nbufs - 1)] + offset);
//cerr << this << ' ' << name() << " @ " << offset << " inport " << in_index << " = buf "
// << min((uint32_t)in_index,nbufs) << " = " << &bufs[min((uint32_t)in_index,nbufs)][offset] << endl;
in_index++;
} else if (LADSPA_IS_PORT_OUTPUT (port_descriptor (port_index))) {
connect_port (port_index, bufs[min((uint32_t) out_index,nbufs)] + offset);
connect_port (port_index, bufs[min((uint32_t) out_index,nbufs - 1)] + offset);
// cerr << this << ' ' << name() << " @ " << offset << " outport " << out_index << " = buf "
// << min((uint32_t)out_index,nbufs) << " = " << &bufs[min((uint32_t)out_index,nbufs)][offset] << endl;
out_index++;

View File

@ -391,12 +391,12 @@ VSTPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in_
int32_t i;
for (i = 0; i < (int32_t) _plugin->numInputs; ++i) {
ins[i] = bufs[min((uint32_t) in_index,maxbuf)] + offset;
ins[i] = bufs[min((uint32_t) in_index,maxbuf - 1)] + offset;
in_index++;
}
for (i = 0; i < (int32_t) _plugin->numOutputs; ++i) {
outs[i] = bufs[min((uint32_t) out_index,maxbuf)] + offset;
outs[i] = bufs[min((uint32_t) out_index,maxbuf - 1)] + offset;
/* unbelievably, several VST plugins still rely on Cubase
behaviour and do not silence the buffer in processReplacing