diff --git a/gst/subparse/samiparse.c b/gst/subparse/samiparse.c index 517e959a91..377c6d730c 100644 --- a/gst/subparse/samiparse.c +++ b/gst/subparse/samiparse.c @@ -504,7 +504,8 @@ html_context_handle_element (HtmlContext * ctxt, } length = strlen (attr_value); - if (attr_value[length - 1] == '"' || attr_value[length - 1] == '\'') { + if (length > 0 && (attr_value[length - 1] == '"' + || attr_value[length - 1] == '\'')) { attr_value[length - 1] = '\0'; }