summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-04-21 15:26:48 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-04-21 15:26:48 +0200
commitd2b1969c1bd71444b4a35e053700b8a7ecce9e8e (patch)
treed7dcc6e3d8d9b848da718d0f359e6c8515cdea5e
parent60fd5c525b59e429c9b0a4c3d500b66f26ef7c85 (diff)
Fix buffer over/underflow
-rw-r--r--dgedit/audioextractor.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/dgedit/audioextractor.cc b/dgedit/audioextractor.cc
index 4c6cd4b..8cb4ed0 100644
--- a/dgedit/audioextractor.cc
+++ b/dgedit/audioextractor.cc
@@ -101,13 +101,13 @@ void AudioExtractor::exportSelections()
// Apply linear fadein
for(size_t fi = 0; fi < fadein; fi++) {
float val = ((float)fi / (float)fadein);
- data[fi] *= val;
+ if(fi < size) data[fi] *= val;
}
// Apply fadeout
for(size_t fo = 0; fo < fadeout; fo++) {
float val = ((float)fo / (float)fadeout);
- data[size - fo] *= val;
+ if(size >= fo) data[size - fo] *= val;
}
audiodata[i].data = data;