fsanitize: member access within null pointer

Kornel Benko kornel at lyx.org
Thu Dec 16 15:35:39 UTC 2021


Am Thu, 16 Dec 2021 15:38:41 +0100
schrieb Pavel Sanda <sanda at lyx.org>:

> > /usr2/src/lyx/lyx-git/src/support/socktools.cpp:114:19: error: cannot initialize a
> > parameter of type 'const struct sockaddr *' with an rvalue of type 'sockaddr_un *'
> >         if ((::bind (fd, reinterpret_cast<sockaddr_un *>(&addr), SUN_LEN(&addr))) ==
> > -1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/include/x86_64-linux-gnu/sys/socket.h:112:49: note: passing argument to parameter
> > '__addr' here extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t
> > __len)  
> 
> Can you setup breakpoint on the critical line and display the content of addr? P

Here it is
Thread 1 "lyx2.4" hit Breakpoint 1, lyx::support::socktools::listen (name=..., queue=3)
    at /usr2/src/lyx/lyx-git/src/support/socktools.cpp:114
114		if ((::bind (fd, reinterpret_cast<sockaddr *>(&addr), SUN_LEN(&addr)))
== -1) {
(gdb) p *addr
Cannot resolve function operator* to any overloaded instance
(gdb) p &addr
$2 = (sockaddr_un *) 0x7fffffffd788
(gdb) x/36x &addr
0x7fffffffd788:	0x01	0x00	0x2f	0x74	0x6d
0x70	0x2f	0x6c
0x7fffffffd790:	0x79	0x78	0x5f 0x74	0x6d	0x70
0x64	0x69
0x7fffffffd798:	0x72 0x2e	0x6b	0x56 0x68	0x6e
0x5a	0x59
0x7fffffffd7a0:	0x4c	0x33 0x31	0x31	0x32 0x38
0x2f	0x6c
0x7fffffffd7a8: 0x79	0x78	0x73 0x6f

As strings:
(gdb) x/10s &addr
0x7fffffffd788:	"\001"
0x7fffffffd78a:	"/tmp/lyx_tmpdir.kVhnZYL31128/lyxsocket"
0x7fffffffd7b1:	""
0x7fffffffd7b2:	""
0x7fffffffd7b3:	""
0x7fffffffd7b4:	""
0x7fffffffd7b5:	""
0x7fffffffd7b6:	""
0x7fffffffd7b7:	""
0x7fffffffd7b8:	"|"
(gdb) 

	Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20211216/95e490ce/attachment.asc>


More information about the lyx-devel mailing list