validate-scenario: Handle non-relative switch

Make sure we stay within the number of present streams (and avoid
out-of-bound read).

CID #1415470
This commit is contained in:
Edward Hervey 2017-11-22 16:35:46 +01:00 committed by Edward Hervey
parent 81c3ab0b12
commit ff6055b195

View file

@ -1257,7 +1257,8 @@ switch_stream (GstValidatePipelineMonitor * monitor, GstValidateAction * action,
if (relative) { /* We are changing track relatively to current track */
index = (current + index) % n;
}
} else
index %= n;
/* Add the new stream we want to switch to */
s = streams[index];