libctf, serialize: functions with no args have a NULL dtd_vlen
authorNick Alcock <nick.alcock@oracle.com>
Thu, 25 Mar 2021 16:32:46 +0000 (16:32 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Thu, 25 Mar 2021 16:32:48 +0000 (16:32 +0000)
commit86f64bf43f70ecefa9232f5b8621b179dfff52fd
treea5bdee1f432ebdbe78db8a65e6d0133907c9c9a5
parent24c877f9b19dc38f9c40e25116175481c8bb78f2
libctf, serialize: functions with no args have a NULL dtd_vlen

Every place that accesses a function's dtd_vlen accesses it only if the
number of args is nonzero, except the serializer, which always tries to
memcpy it.  The number of bytes it memcpys in this case is zero, but it
is still undefined behaviour to copy zero bytes from a null pointer.
So check for this case explicitly.

libctf/ChangeLog
2021-03-25  Nick Alcock  <nick.alcock@oracle.com>

PR libctf/27628
* ctf-serialize.c (ctf_emit_type_sect): Allow for a NULL vlen in
CTF_K_FUNCTION types.
libctf/ChangeLog
libctf/ctf-serialize.c