[MPlayer-cvslog] r19618 - trunk/libass/ass.c

eugeni subversion at mplayerhq.hu
Fri Sep 1 00:45:21 CEST 2006


Author: eugeni
Date: Fri Sep  1 00:45:20 2006
New Revision: 19618

Modified:
   trunk/libass/ass.c

Log:
Bugfix: potential write of unallocated memory.


Modified: trunk/libass/ass.c
==============================================================================
--- trunk/libass/ass.c	(original)
+++ trunk/libass/ass.c	Fri Sep  1 00:45:20 2006
@@ -282,9 +282,11 @@
 		if (strcasecmp(tname, "Text") == 0) {
 			char* last;
 			event->Text = strdup(p);
-			last = event->Text + strlen(event->Text) - 1;
-			if (*last == '\r')
-				*last = 0;
+			if (*event->Text != 0) {
+				last = event->Text + strlen(event->Text) - 1;
+				if (last >= event->Text && *last == '\r')
+					*last = 0;
+			}
 			mp_msg(MSGT_GLOBAL, MSGL_DBG2, "Text = %s\n", event->Text);
 			event->Duration -= event->Start;
 			free(format);



More information about the MPlayer-cvslog mailing list