[FFmpeg-devel] [PATCH] Fix segfault in x11grab when drawing Cursor on Xservers that don't support the XFixes extension

Brenden Bain brenden.bain
Sat Jul 3 09:20:52 CEST 2010


On Fri, 2010-07-02 at 17:00 +0200, Michael Niedermayer wrote:
> >  x11grab.c |   20 +++++++++++++++++---
> >  1 file changed, 17 insertions(+), 3 deletions(-)
> > 232ef00cd548c0a8ab48d48ec883d687b0e46eff  x11_segfault_fix.patch
> > Index: libavdevice/x11grab.c
> > ===================================================================
> > --- libavdevice/x11grab.c     (revision 23763)
> > +++ libavdevice/x11grab.c     (working copy)
> > @@ -91,7 +91,7 @@
> >      XImage *image;
> >      int x_off = 0;
> >      int y_off = 0;
> > -    int use_shm;
> > +    int use_shm, ignore;
> >      char *param, *offset;
> >  
> >      param = av_strdup(s1->filename);
> > @@ -115,6 +115,11 @@
> >          return AVERROR(EIO);
> >      }
> >  
> > +    if (!XFixesQueryExtension(dpy, &ignore, &ignore)) {
> > +        av_log(s1, AV_LOG_INFO, "Disabling cursor recording. Unable
> to query cursor shape.\n");
> > +        x11grab->nomouse = 1;
> > +    }
> > +
> >      st = av_new_stream(s1, 0);
> >      if (!st) {
> >          return AVERROR(ENOMEM);
> > @@ -245,8 +250,9 @@
> >   *          coordinates
> >   * @param x Mouse pointer coordinate
> >   * @param y Mouse pointer coordinate
> > + * @return !0 if error, 0 if successful
> 
> negative values generally means errors and in form of error
> codes where a existing one make sense, otherwise -1 is a nice choice

Done. Returned AVERROR(EIO) which is what the other functions in this
file do when they encounter an X11 error.

Brenden.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x11_segfault_fix.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100703/57eb232e/attachment.bin>



More information about the ffmpeg-devel mailing list