Bug 286

Summary: Xi: XGetDeviceDontPropagateList does not allocate enough memory on 64-Bit machines
Product: xorg Reporter: Andreas Luik <luik>
Component: Lib/XiAssignee: Default Bug Report Assignee <xorg>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: high CC: mharris
Version: unspecified   
Hardware: Alpha   
OS: All   
i915 platform: i915 features:
Description Flags
fix for XGetDeviceDontPropagateList() on 64-Bit machines none

Description Andreas Luik 2004-03-08 02:47:17 UTC
XEventClass is typedef'd as an "unsigned long", therefore, on an
Alpha, this is a 64-bit long cardinal, i.e. 8 bytes long.
Unfortunately, in the XGetDeviceDontPropagateList function, when the
list of XEventClass entries is allocated, the number of bytes is only
(rep.length << 2), i.e. rep.length*4.  Instead, the proper number of
bytes to allocate for the list would be "rep.length * sizeof(XEventClass).

With the current code, the memory allocated for the list will be
overwritten on a 64-bit machine like the Compaq Alpha.

The function XGetSelectedExtensionEvents (in lib/Xi/XGtSelect.c) uses
the correct computation as suggested above.
Comment 1 Andreas Luik 2004-03-08 02:48:25 UTC
Created attachment 131 [details] [review]
fix for XGetDeviceDontPropagateList() on 64-Bit machines
Comment 2 Egbert Eich 2004-03-16 04:53:42 UTC
Thanks for catching this!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.