Fix distance calculation during relayer (#9286)
Due to rounding (r->position_sample() - start.samples()) can become negative even if (r->position () >= start). with k = start_division and start_division < 0 this caused an invalid vector access `layers[j-1][k]`.
This commit is contained in:
parent
6dadac73ab
commit
5453e6f1f7
@ -2611,8 +2611,8 @@ Playlist::relayer ()
|
||||
int end_division = 0;
|
||||
|
||||
if (division_size > 0) {
|
||||
start_division = floor ( (r->position_sample() - start.samples()) / division_size);
|
||||
end_division = floor ( (r->position_sample() + r->length_samples() - start.samples()) / division_size );
|
||||
start_division = start.distance (r->position ()).samples () / division_size;
|
||||
end_division = start.distance (r->position () + r->length ()).samples () / division_size;
|
||||
if (end_division == divisions) {
|
||||
end_division--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user