If the len of the string turns out to be 0, str[len - 1] resolved to
str[-1] which is not a good idea.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46543
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2147>
if (sscanf (str, "[%u:%02u.%02u]", &n1, &n2, &n3) == 3 ||
sscanf (str, "[%u:%02u.%03u]", &n1, &n2, &n3) == 3) {
all_lines_good = TRUE;
- } else if (str[len - 1] == ']' && strchr (str, ':') != NULL) {
+ } else if (len > 0 && str[len - 1] == ']' && strchr (str, ':') != NULL) {
all_lines_good = TRUE;
} else {
all_lines_good = FALSE;