From: Grigori Goronzy Date: Mon, 15 Aug 2011 22:26:16 +0000 (+0200) Subject: Fix trimming function X-Git-Tag: 0.13.0~28^2~107 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5091c88d10cbea95f3e45b31a8738d7cd8e3819;p=libass Fix trimming function Did not correctly handle empty strings (only whitespace). Whoops. --- diff --git a/libass/ass_utils.c b/libass/ass_utils.c index 0fc8b2a..40e6533 100644 --- a/libass/ass_utils.c +++ b/libass/ass_utils.c @@ -338,7 +338,7 @@ char *trim_space(char *str) int right = strlen(str) - 1; while (isspace(str[left])) left++; - while (isspace(str[right])) right--; + while (right > left && isspace(str[right])) right--; if (left > 0) for (i = 0; i <= right - left; i++)