[PATCH] Fix write to uninitialized bytes for XCB event

Enrico Forestieri forenr at lyx.org
Wed Feb 19 17:28:51 UTC 2020


On Wed, Feb 19, 2020 at 06:13:08PM +0100, Pavel Sanda wrote:
> On Wed, Feb 19, 2020 at 05:24:46PM +0100, Enrico Forestieri wrote:
> > > Did not try, but I am afraid generally it won't, because 
> > > xcb_selection_notify_event_t is not enforced to have 32 bits,
> > > while that's requested by underlying X routines. That's why
> > > the padding by 0s.
> > 
> > Ok, then probably a simple
> > 	alignas(32) xcb_selection_notify_event_t nev;
> > would have worked.
> 
> Nice.
> 
> > We are requiring C++11 these days, right?
> 
> Can't remember, notions of gcc 4.7 in INSTALL is not strongly indicative of that ;)

Uh? In the Requirements section I read:

  First of all, you will need a C++11 standard conforming compiler, like gcc
  (at least 4.7) or clang.

> Need to check whether one of my antique system still compiles with 4.7 or 4.8,
> maybe we can bump to 4.8.
> 
> In any case I still tend to prefer using Qt macro (not because of technical
> superiority but because if API changes then Qt folks will probably hit and
> fix it sooner than we will).

I could not find the macro you mention in the current Qt sources (5.14.1),
but I found the following in src/plugins/platforms/xcb/xcbconnection.h

template <typename T>
struct alignas(32) q_padded_xcb_event : T { };

which is then used as
	q_padded_xcb_event<xcb_selection_notify_event_t> event = {};

-- 
Enrico


More information about the lyx-devel mailing list