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

Michael Niedermayer michaelni
Sat Jul 3 19:21:50 CEST 2010


On Sat, Jul 03, 2010 at 05:20:52PM +1000, Brenden Bain wrote:
> 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.

>  x11grab.c |   20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 592f2f8e954084b3921a4c43b26f12ec569814de  x11_segfault_fix.patch

looks ok to someone who knows little about X11

that reminds me, we need a volunteer for x11grab maintainership
MAINTAINERS lists noone
any volunteers?

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- 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-devel/attachments/20100703/555607e5/attachment.pgp>



More information about the ffmpeg-devel mailing list