[PATCH] Fix write to uninitialized bytes for XCB event
Scott Kostyshak
skostysh at lyx.org
Mon Feb 24 19:02:32 UTC 2020
On Mon, Feb 24, 2020 at 06:39:25PM +0100, Enrico Forestieri wrote:
> On Mon, Feb 24, 2020 at 11:05:51AM -0500, Scott Kostyshak wrote:
> >
> > Apparently another approach would be to add the following:
> >
> > memset(&padded_event, 0, sizeof(padded_event));
> >
> > Valgrind does not complain when this line is added to the union patch.
>
> I am baffled. The last suggestion I have is trying
>
> alignas(32) xcb_selection_notify_event_t nev = {0};
Valgrind still gives the error. I attach the full Valgrind log.
Scott
-------------- next part --------------
==20157== Memcheck, a memory error detector
==20157== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==20157== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==20157== Command: /home/scott/lyxbuilds/master/CMakeBuild/bin/lyx -userdir /home/scott/lyxbuilds/master/user-dir
==20157== Parent PID: 19128
==20157==
==20157== Syscall param writev(vector[...]) points to uninitialised byte(s)
==20157== at 0x61F578D: __writev (writev.c:26)
==20157== by 0x61F578D: writev (writev.c:24)
==20157== by 0x4A83BFC: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==20157== by 0x4A83FD0: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==20157== by 0x4A84246: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==20157== by 0x4A84ACB: xcb_flush (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==20157== by 0x17CC66A: lyx::frontend::GuiApplication::nativeEventFilter(QByteArray const&, void*, long*) (GuiApplication.cpp:3370)
==20157== by 0x5AA4EEE: QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) (qabstracteventdispatcher.cpp:484)
==20157== by 0x9C37854: QXcbConnection::handleXcbEvent(xcb_generic_event_t*) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.12.4)
==20157== by 0x9C38829: QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.12.4)
==20157== by 0x9C63286: ??? (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.12.4)
==20157== by 0x633684C: g_main_context_dispatch (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6200.1)
==20157== by 0x6336ACF: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6200.1)
==20157== Address 0x8b13aa8 is 4,552 bytes inside a block of size 21,152 alloc'd
==20157== at 0x483CD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==20157== by 0x4A83590: xcb_connect_to_fd (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==20157== by 0x4A876E1: xcb_connect_to_display_with_auth_info (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==20157== by 0x880BB79: _XConnectXCB (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==20157== by 0x87FC318: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==20157== by 0x9C64B5F: QXcbBasicConnection::QXcbBasicConnection(char const*) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.12.4)
==20157== by 0x9C363C1: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.12.4)
==20157== by 0x9C3B0F9: QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**) (in /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.12.4)
==20157== by 0x9BC2512: ??? (in /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so)
==20157== by 0x534C532: QPlatformIntegrationFactory::create(QString const&, QStringList const&, int&, char**, QString const&) (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.12.4)
==20157== by 0x535A300: QGuiApplicationPrivate::createPlatformIntegration() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.12.4)
==20157== by 0x535BD47: QGuiApplicationPrivate::createEventDispatcher() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.12.4)
==20157== Uninitialised value was created by a stack allocation
==20157== at 0x17CC7BD: non-virtual thunk to lyx::frontend::GuiApplication::nativeEventFilter(QByteArray const&, void*, long*) (GuiApplication.h:115)
==20157==
==20157==
==20157== HEAP SUMMARY:
==20157== in use at exit: 3,044,089 bytes in 26,849 blocks
==20157== total heap usage: 1,815,383 allocs, 1,788,534 frees, 344,441,003 bytes allocated
==20157==
==20157== LEAK SUMMARY:
==20157== definitely lost: 784 bytes in 4 blocks
==20157== indirectly lost: 46,746 bytes in 218 blocks
==20157== possibly lost: 3,392 bytes in 26 blocks
==20157== still reachable: 2,927,423 bytes in 26,062 blocks
==20157== of which reachable via heuristic:
==20157== length64 : 3,896 bytes in 71 blocks
==20157== newarray : 6,376 bytes in 53 blocks
==20157== suppressed: 0 bytes in 0 blocks
==20157== Rerun with --leak-check=full to see details of leaked memory
==20157==
==20157== For lists of detected and suppressed errors, rerun with: -s
==20157== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200224/1275b463/attachment-0001.asc>
More information about the lyx-devel
mailing list