[MPlayer-dev-eng] Segmentation fault when calling xvid encoding filter, patch included

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Jun 13 11:27:08 CEST 2005


Hi,
On Sat, Jun 11, 2005 at 04:53:34PM +0200, Werner Kehlenbach wrote:
> The reason is that *args=0 (see mem dump below) and the strcmp can not handle 
> this and crashes. I also attach the modified function avoiding this as a 
> patch. I successfully thereafter generated a XviD file from DVD.

Not the right way to fix this IMHO.

> (gdb) set args dvd://2 -chapter 1-1 -dvd-device '/dev/dvd' -alang un -oac 
> mp3lame -lameopts abr:br=128:aq=0  -nocache -noaspect -noautoexpand -noskip  
> -vf-add softskip,crop=720:576,pp=hb/vb/dr,scale=:  -o /dev/null -ovc xvid 
> -xvidencopts bitrate=1230:vhq=2:pass=1

Whoever wrote the parser code didn't expect something like this:
"scale=:"
I can't really blame him, since it doesn't really make sense, it would
do exactly the same as just "scale".
Nevertheless the attached patch should fix it.
Any comments? If nobody objects I will probably apply tomorrow (though I
would be happy if you could test it a bit before).

Greetings,
Reimar Döffinger
-------------- next part --------------
--- m_option.c	2005-05-16 12:04:38.000000000 +0200
+++ m_option.c	2005-06-13 11:19:58.000000000 +0200
@@ -1261,8 +1261,16 @@
     last_ptr = ptr+1;
   }
   if(r < 0) return r;
+  if (!last_ptr[0]) // count an empty field at the end, too
+    nold++;
+  if (nold > nopts) {
+    mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Too many options for %s\n", name);
+    return M_OPT_OUT_OF_RANGE;
+  }
   if(!_ret) // Just test
     return 1;
+  if (n == 0) // No options or only empty options
+    return 1;
 
   ret = malloc((n+2)*2*sizeof(char*));
   n = nold = 0;
@@ -1309,6 +1317,8 @@
     return r;
   if(!dst)
     return 1;
+  if (!opts) // no arguments given
+    return 1;
 
   for(r = 0 ; opts[r] ; r += 2)
     m_struct_set(desc,dst,opts[r],opts[r+1]);


More information about the MPlayer-dev-eng mailing list