diff options
author | David Robillard <d@drobilla.net> | 2008-10-11 01:12:31 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-10-11 01:12:31 +0000 |
commit | 460d15f72adae3100370c2f0242c788fce6895fd (patch) | |
tree | 00ef0181dd592e60cfd80a30e320edf2a86feaff /src/engine | |
parent | baaea2e3ec5ebc2eec134fa0db5a9bdc70def497 (diff) | |
download | ingen-460d15f72adae3100370c2f0242c788fce6895fd.tar.gz ingen-460d15f72adae3100370c2f0242c788fce6895fd.tar.bz2 ingen-460d15f72adae3100370c2f0242c788fce6895fd.zip |
Fix crash when copying from a large buffer to a smaller one (just copy the first bit) (fix ticket #232).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1634 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/AudioBuffer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/engine/AudioBuffer.cpp b/src/engine/AudioBuffer.cpp index 098103c0..f13e109f 100644 --- a/src/engine/AudioBuffer.cpp +++ b/src/engine/AudioBuffer.cpp @@ -192,7 +192,6 @@ void AudioBuffer::copy(const Buffer* src, size_t start_sample, size_t end_sample) { assert(end_sample >= start_sample); - assert(end_sample < _size); assert(src); assert(src->type() == DataType::CONTROL || DataType::AUDIO); @@ -202,7 +201,8 @@ AudioBuffer::copy(const Buffer* src, size_t start_sample, size_t end_sample) const Sample* const src_buf = ((AudioBuffer*)src)->data(); assert(src_buf); - for (size_t i=start_sample; i <= end_sample; ++i) + const size_t to_copy = std::min(end_sample, _size); + for (size_t i=start_sample; i <= to_copy; ++i) buf[i] = src_buf[i]; } |