[MPlayer-dev-eng] [PATCH] Re: [BUG] Skipping in MPEG4 movie breaks mplayer

Reder, Uwe Uwe.Reder at 3SOFT.de
Thu Sep 11 10:23:26 CEST 2003


Hi,

I already sent this mail some days ago from another account. Since it didn't show up on the list I assume that emails from non-registered mail addresses aren't checked regularly anymore.

> > Skipping back past the start or skipping forward past the end of the
> > MPEG4 file in http://www.s1.hashmirror.com/navone/BB_story1_Web.mp4
> > breaks mplayer 1.0pre1.
> What does 'break' means?
Break means crash [sig 11]. mplayer crashes in the module 
"libmpdemux/demux_mov.c", function "demux_mov_fill_buffer()", calling 
memcpy() with a NULL pointer as the second argument. The code there looks 
somewhat like this:

if(trak->pos==0 && trak->stream_header_len>0){
  ...
  memcpy(..., trak->stream_header, ...)
  ...
  trak->stream_header = NULL
  ...
}

First time we come through here, we set stream_header = NULL. If pos == 0 (I 
suppose true when I rewind the stream past the beginning of the video) we 
check for stream_header_len > 0 which was not reset. We end up calling 
memcpy() with a NULL-pointer. IMHO, I think we should check for stream_header 
!= NULL or set stream_header_len = 0.

This is a patch that solves the problem for me:

--- snip snip ---

2003-09-09 01:45 diff -laur libmpdemux/demux_mov.c.orig libmpdemux/demux_mov.c 
Page 1

--- libmpdemux/demux_mov.c.orig 2003-09-09 01:22:38.000000000 +0200
+++ libmpdemux/demux_mov.c      2003-09-09 01:45:03.000000000 +0200
@@ -1670,6 +1670,7 @@
     stream_read(demuxer->stream,dp->buffer+trak->stream_header_len,x);
     free(trak->stream_header);
     trak->stream_header = NULL;
+    trak->stream_header_len = 0;
     dp->pts=pts;
     dp->flags=0;
     dp->pos=pos; // FIXME?

--- snip snip ---

Bye,
Uwe.



More information about the MPlayer-dev-eng mailing list