[FFmpeg-cvslog] r13061 - trunk/libavformat/avio.c

Michael Niedermayer michaelni
Wed May 7 21:41:21 CEST 2008


On Wed, May 07, 2008 at 12:00:01PM -0700, Corey Hickey wrote:
> michael wrote:
> > Author: michael
> > Date: Mon May  5 11:17:56 2008
> > New Revision: 13061
> > 
> > Log:
> > Check url_seek() in url_open().
> > 
> > 
> > Modified:
> >    trunk/libavformat/avio.c
> > 
> > Modified: trunk/libavformat/avio.c
> > ==============================================================================
> > --- trunk/libavformat/avio.c	(original)
> > +++ trunk/libavformat/avio.c	Mon May  5 11:17:56 2008
> > @@ -113,6 +113,12 @@ int url_open(URLContext **puc, const cha
> >          *puc = NULL;
> >          return err;
> >      }
> > +
> > +    //We must be carefull here as url_seek() could be slow, for example for http
> > +    if(   (flags & (URL_WRONLY | URL_RDWR))
> > +       || !strcmp(proto_str, "file"))
> > +        if(!uc->is_streamed && url_seek(uc, 0, SEEK_SET) < 0)
> > +            uc->is_streamed= 1;
> >      *puc = uc;
> >      return 0;
> >   fail:
> 
> This patch makes mencoder segfault with lavf muxing. I don't know if
> mencoder or lavf should be changed, so I'm reporting it here as a start.
> 
> Steps to reproduce:
> $ mencoder -nosound -ovc copy -of lavf input.avi -o output.avi
> 
> Here's what appears to be happening:
> 1. The new code in avio.c calls url_seek()
> 2. url_seek() calls a pointer to mp_seek()  (in muxer_lavf.c)
> 3. mp_seek hits a null pointer dereference because muxer is null
> ----however----
> 4. muxer is set in muxer_lavf.c immediately below the code that calls
>    libavformat and does what I described above.
> 
> I can't just move that line that sets muxer because it's actually
> storing muxer in a URLContext struct member, and the pointer to that
> struct isn't set until after the code that now segfaults. Here's the
> code in muxer_lavf.c I'm talking about:
> 
> -------------------------------------------------------------------
> if(url_fopen(&priv->oc->pb, mp_filename, URL_WRONLY))
> {
> 	mp_msg(MSGT_MUXER, MSGL_FATAL, "Could not open outfile\n");
>         goto fail;
> }

> ((URLContext*)(priv->oc->pb->opaque))->priv_data= muxer;

mp_open() should set this IMHO.
(for example by using mp_filename "menc://%p" or a static var)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you really think that XML is the answer, then you definitly missunderstood
the question -- Attila Kinali
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20080507/cce27024/attachment.pgp>



More information about the ffmpeg-cvslog mailing list