From ff6055b1958c8c575271420bc7e43ef032349e8f Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 22 Nov 2017 16:35:46 +0100 Subject: [PATCH] validate-scenario: Handle non-relative switch Make sure we stay within the number of present streams (and avoid out-of-bound read). CID #1415470 --- validate/gst/validate/gst-validate-scenario.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 11bda7fe53..94d74dc9ec 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -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];