[MPlayer-dev-eng] Re: MPlayer1.0-pre5 crashes when trying to read subtitles

Michal Marek michal.marek at matfyz.cz
Fri Jul 16 16:13:41 CEST 2004


> I tried MP1.0-pre5, but it crashes, when trying to use subtitles.

I hope the attached path fixes it w/o removing enca -- the problem was
on line 1355 in subreader.c when -subcp was not set at all. Now it
should work like that: 
  
    mplayer -subcp enca:language:fallback

I'm not subscribed to this list so Cc to me if you have any comments.

-- Michal Marek
-------------- next part --------------
--- MPlayer-1.0pre5/subreader.c	Fri Jun 25 18:49:51 2004
+++ MPlayer-1.0pre5-enca-fix/subreader.c	Fri Jul 16 11:35:09 2004
@@ -1044,10 +1044,10 @@
 #ifdef HAVE_ENCA
 void	subcp_open_noenca ()
 {
-    char enca_lang[100], enca_fallback[100];
+    char enca_lang[3], enca_fallback[100];
     if (sub_cp) {
-	if (sscanf(sub_cp, "enca:%2s:%s", enca_lang, enca_fallback) == 2
-	    || sscanf(sub_cp, "ENCA:%2s:%s", enca_lang, enca_fallback) == 2) {
+	if (sscanf(sub_cp, "enca:%2s:%99s", enca_lang, enca_fallback) == 2
+	    || sscanf(sub_cp, "ENCA:%2s:%99s", enca_lang, enca_fallback) == 2) {
 	    subcp_open(enca_fallback);
 	} else {
 	    subcp_open(sub_cp);
@@ -1317,7 +1317,7 @@
     int n_max, n_first, i, j, sub_first, sub_orig;
     subtitle *first, *second, *sub, *return_sub;
     sub_data *subt_data;
-    char enca_lang[100], enca_fallback[100];
+    char enca_lang[3], enca_fallback[100];
     int uses_time = 0, sub_num = 0, sub_errs = 0;
     char *current_sub_cp=NULL;
     struct subreader sr[]=
@@ -1352,8 +1352,10 @@
 
 #ifdef USE_ICONV
 #ifdef HAVE_ENCA
-    if (sscanf(sub_cp, "enca:%2s:%s", enca_lang, enca_fallback) == 2
-	|| sscanf(sub_cp, "ENCA:%2s:%s", enca_lang, enca_fallback) == 2) {
+    
+    if (sub_cp 
+	&& (sscanf(sub_cp, "enca:%2s:%99s", enca_lang, enca_fallback) == 2
+	|| sscanf(sub_cp, "ENCA:%2s:%99s", enca_lang, enca_fallback) == 2)) {
 	current_sub_cp = guess_cp(fd, enca_lang, enca_fallback);
     } else {
 	current_sub_cp = sub_cp ? strdup(sub_cp) : NULL;


More information about the MPlayer-dev-eng mailing list