changeset 21835:5ee5281c78f8

Avoid invalid memory access in ass_process_subtitle for empty subtitles with sub->lines <= 0
author reimar
date Sun, 07 Jan 2007 16:07:45 +0000
parents 8d486fd6cf2f
children 7c5e893dff54
files libass/ass_mp.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_mp.c	Sun Jan 07 13:05:59 2007 +0000
+++ b/libass/ass_mp.c	Sun Jan 07 16:07:45 2007 +0000
@@ -175,7 +175,7 @@
 	for (j = 0; j < sub->lines; ++j)
 		p += snprintf(p, end - p, "%s\\N", sub->text[j]);
 
-	p-=2; // remove last ' '
+	if (sub->lines > 0) p-=2; // remove last "\N"
 	*p = 0;
 
 	if (check_duplicate_plaintext_event(track)) {