summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libass/ass_utils.c2
1 files changed, 1 insertions, 1 deletions
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++)