13
0

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:
Robin Gareus 2023-03-22 01:42:14 +01:00
parent 6dadac73ab
commit 5453e6f1f7
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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--;
}