[oe] xmonobut
Alain2210
alain2210 at free.fr
Thu Nov 5 09:26:15 UTC 2009
Hello,
thanks for the answers.
Selon Phil Blundell <pb at reciva.com>:
> On Tue, 2009-11-03 at 14:51 +0100, Holger Hans Peter Freyther wrote:
> > On Monday 28 September 2009 02:16:07 Alain2210 wrote:
> > > Hello,
> > >
> > > xmonobut segfault. I need this patch to get it works again.
> >
> > > - unsigned char map[6];
> > > + unsigned char map[31];
> > ...
> > > + buts = XGetPointerMapping(dpy, map, 32);
> > ,,.
> > > + while((rst = XSetPointerMapping(dpy, map, 32)) == MappingBusy);
> >
> > 31. vs 32... please send an updated patch
Sorry for the mistake.
> Looking at this patch again, I think it is just broken and (even aside
> from the 31/32 thing) should not be applied.
I have seen in the september answer that you says that xlib should be corrected.
In fact, I do not understand the behaviour of XG/SetPointerMapping since the
third argument seems to be ignored in a certain sense.
>
> I guess the cause of the original segfault was that "buts" is set to a
> value greater than six and hence the XSetPointerMapping() call runs off
> the end of the array. However, the solution presented in the patch,
> i.e. just ignoring the return value from XGetPointerMapping()
> altogether, doesn't seem too good either since this will cause
> XSetPointerMapping() to read uninitialised garbage from the balance of
> the array.
>
> A minimal fix for the original crash would probably be to insert
> something like:
>
> if (buts > sizeof(map))
> buts = sizeof(map);
>
> after the XGetPointerMapping() call.
I will try this. (and will try to remember what was exactly the problem).
> A slightly better fix would
> perhaps be to make an initial call to XGetPointerMapping() with nmap=0
> to find out how many buttons are present, then to dynamically allocate
> an array of the right size and read the mapping into it.
Sorry, it is beyond my capabilities.
Thanks,
Alain
More information about the Openembedded-devel
mailing list