From eef53ef6ed7aad892e4a1fe90a512df1ab0890ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 27 Nov 2016 12:20:11 +0200 Subject: [PATCH] dash: Fix stripping of space at the beginning/end of durations The way how strchr() was called here, it could easily read after the end of the string. Use g_ascii_isspace() instead. Detected by asan in the unit test. --- ext/dash/gstmpdparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index ff303e9b62..898f0fb2bb 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -984,11 +984,11 @@ gst_mpdparser_parse_duration (const char *str, guint64 * value) goto error; } /* skip leading/trailing whitespace */ - while (strchr (" \t", str[0])) { + while (g_ascii_isspace (str[0])) { str++; len--; } - while (len > 0 && strchr (" \t", str[len - 1])) + while (len > 0 && g_ascii_isspace (str[len - 1])) --len; /* read "P" for period */