New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 656506 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Incorrect usage of libXi: XListInputDevices

Project Member Reported by drinkcat@chromium.org, Oct 17 2016

Issue description

Issue with Chromium's usage of XListInputDevices reported here (https://lists.x.org/archives/xorg-devel/2016-October/051632.html) :

---

On Fri, Oct 14, 2016 at 02:28:55PM +0100, Emil Velikov wrote:
> On 13 October 2016 at 04:58, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> > We used to always set *ndevices to the number of devices returned by the
> > server. This magically worked because we pretty much never returned an error
> > except on faulty server or library implementations. With 19a9cd60 we now have
> > more chances of getting an error, so the polite thing is to just leave *ndevices
> > alone when we error out.
> >
> > Document it as such in the man page, just in case someone accidentally reads
> > it.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > CC: Niels Ole Salscheider <niels_ole at salscheider-online.de>
> > ---
> > Changes to v1:
> > - Niels' first patch set ndevices to 0, this one leaves it untouched
> >
> Slightly split between "doing the right thing" and "the cat is out of
> the bag" ;-)

I don't think the cat is out of the bag anyway here. ndevices was *always*
wrong in case of error. either it was untouched or set to the list of
devices even though NULL was returned. the only reason this worked is
because we never had an error. the cat remains thus firmly packaged, if (as
usual) in an unclear state of vividness.
 
> I'm leaning towards the former, although we might want to prod
> Chromium devs and/or send them a patch ?

the chromium code is broken, it cannot handle *any* error case. on the first
call, the devices list is NULL and count is 0. XListInputDevices is
fails, we currently get a NULL list but a count of != 0. Which
will then crash when looping through the list and dereferencing the
nonexistent members. At least with this fix, count stays on 0 and while
XListInputDevices will get called every time, everything else
should simply skip over any loop over the devices then (since count remains
at 0).

---

sadrul: I have no idea what this is about, can you have a look?
 

Comment 1 by sadrul@chromium.org, Oct 19 2016

Status: Started (was: Available)
Thanks for filing the bug! Looking
Sadrul: Going through old bugs, and wondering what's the status of this?

Sign in to add a comment