[PATCH] Fix write to uninitialized bytes for XCB event

Enrico Forestieri forenr at lyx.org
Wed Feb 19 16:24:46 UTC 2020


On Wed, Feb 19, 2020 at 08:42:57AM +0100, Pavel Sanda wrote:
> On Wed, Feb 19, 2020 at 08:24:43AM +0100, Enrico Forestieri wrote:
> > On Tue, Feb 18, 2020 at 09:49:08PM -0500, Scott Kostyshak wrote:
> > > 
> > > Attached is a patch. I really don't know what I'm doing. The use of
> > > calloc scares me. I just used the xcb_send_event man page and
> > > experimented until compilation and valgrind did not complain.
> > > 
> > > Could anyone take a close look at this? If there is a better fix, please
> > > go ahead.
> > 
> > Does simply replacing
> > 	xcb_selection_notify_event_t nev;
> > with
> > 	xcb_selection_notify_event_t nev = {0};
> > help?
> 
> 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. We are requiring C++11 these days, right?

-- 
Enrico


More information about the lyx-devel mailing list