[MPlayer-dev-eng] [PATCH] SSA subtitle reader fix

pl p_l at gmx.fr
Tue Jun 25 13:24:34 CEST 2002


On Tue, Jun 25, 2002 at 12:50:31AM +0200, Dirk wrote:
> Diego Biurrun wrote:
> 
> > Please send this as a unified diff.  Read DOCS/tech/patches.txt for all
> > the details.
> > Thanks
> >
> > Diego
> 
> here it is..

Does it break other SSA subtitles ? (I don't have any so please test)

Besides we'll get segfault if a line is slightly malformed.
Please fix this (proper testing of line2 nullity).


> Index: subreader.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/subreader.c,v
> retrieving revision 1.64
> diff -u -r1.64 subreader.c
> --- subreader.c	3 Jun 2002 23:23:02 -0000	1.64
> +++ subreader.c	24 Jun 2002 23:08:08 -0000
> @@ -392,10 +392,18 @@
>  			&hour1, &min1, &sec1, &hunsec1, 
>  			&hour2, &min2, &sec2, &hunsec2,
>  			line3) < 9);
> +
> +#if 0
>  	line2=strstr(line3,",,");
> -	if (!line2) return NULL;
> -	line2 ++;
> +#else
> +        line2=strchr(line3, ',');
> +        line2=strchr(++line2, ',');
> +        line2=strchr(++line2, ',');
> +        line2=strchr(++line2, ',');
> +        line2=strchr(++line2, ',');
> +#endif
>  	line2 ++;
> +	if (!line2) return NULL;

>  
>  	current->lines=0;num=0;
>  	current->start = 360000*hour1 + 6000*min1 + 100*sec1 + hunsec1;


-- 
Best regards,
  pl



More information about the MPlayer-dev-eng mailing list