[MPlayer-dev-eng] Re: [MPlayer-users] subtitle reader crashes on Solaris

Götz Waschk waschk at informatik.uni-rostock.de
Thu Jul 3 15:44:06 CEST 2003


Am Mittwoch,  2. Juli 2003, 14:08:18 Uhr MET, schrieb Götz Waschk:
> the subtitle reader that automatically tries to open a matching
> subtitle file for your video, crashes on Solaris. This happens
> everytime there is a .txt file in the same directory as the video
> file.

OK,

I've found the problem, it's in subreader.c. On Solaris, you cannot
pass a null pointer to sprintf, as in this code snippet:
sprintf(tmpresult, "%s %s", f_fname_trim, tmp_sub_id);
If tmp_sub_id is a null pointer, this causes a segmentation fault on
Solaris. On Linux, the string (null) is generated instead. 

I've tried to emulate this with the attached patch, please take a
look.

CU
-- 
What difference does it make to the dead, the orphans and the
homeless, whether the mad destruction is wrought under the name of
totalitarianism or the holy name of liberty or democracy?
    Mahatma Gandhi (1869 - 1948), "Non-Violence in Peace and War"
-------------- next part --------------
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.112
diff -u -r1.112 subreader.c
--- subreader.c	1 Jul 2003 09:29:31 -0000	1.112
+++ subreader.c	3 Jul 2003 13:43:12 -0000
@@ -1686,7 +1686,10 @@
 		// we have a (likely) subtitle file
 		if (found) {
 		    int prio = 0;
-		    sprintf(tmpresult, "%s %s", f_fname_trim, tmp_sub_id);
+		    if (tmp_sub_id)
+		      sprintf(tmpresult, "%s %s", f_fname_trim, tmp_sub_id);
+		    else
+		      sprintf(tmpresult, "%s (null)", f_fname_trim);
 		    if (strcmp(tmp_fname_trim, tmpresult) == 0 && sub_match_fuzziness >= 1) {
 			// matches the movie name + lang extension
 			prio = 5;


More information about the MPlayer-dev-eng mailing list