ref: a7e458f93474113be6f3727f99d6e5b4855b68ec
parent: 5aec5052b1d25d7878757d3b32c2165183090dbc
author: Olav Sørensen <[email protected]>
date: Mon Apr 11 17:17:03 EDT 2022
Fix possible loop corruption after cutting/deleting sample data
--- a/src/pt2_sampler.c
+++ b/src/pt2_sampler.c
@@ -1560,7 +1560,7 @@
updateSamOffset();
}
- if (s->loopLength > 2) // loop enabled?
+ if (s->loopStart+s->loopLength > 2) // loop enabled?
{
if (markEnd > s->loopStart)
{
@@ -1593,6 +1593,13 @@
}
s->length = copyLength & ~1;
+
+ // disable loop if invalid
+ if (s->loopStart+s->loopLength > s->length)
+ {
+ s->loopStart = 0;
+ s->loopLength = 2;
+ }
if (sampler.samDisplay <= 2)
{