dbus/dbus
Marc Mutz 178872ea6f DBusMessage: Fix UB (misaligned access) in call to _dbus_header_set_field_basic()
The const void* 'value' pointer that is passed the address of a
uint32_t here eventually ends up in _dbus_marshal_write_basic(), which
casts it to a DBusBasicValue, a union type that has an alignment of
eight on 64-bit platforms and is therefore more-aligned than the
uint32.

The read of a value of a more-aligned type through a pointer to a less
-aligned type is undefined behaviour.

Fix by storing the uint32 in a DBusBasicValue and passing that instead.

Found by UBSan:

  dbus/dbus/dbus-marshal-basic.c:832:14: runtime error: member access within misaligned address 0x7fdb8dac3a04 for type 'const union DBusBasicValue', which requires 8 byte alignment
  0x7fdb8dac3a04: note: pointer points here
    4a 87 b5 71 01 00 00 00  40 7d 01 00 00 61 00 00  10 3b ac 8d db 7f 00 00  2c 2a 3e 94 db 7f 00 00
                ^
    #0 0x7fdb9444a2c3 in _dbus_marshal_write_basic dbus/dbus/dbus-marshal-basic.c:832
    #1 0x7fdb943d22fb in _dbus_type_writer_write_basic_no_typecode dbus/dbus/dbus-marshal-recursive.c:1605
    #2 0x7fdb943d64e9 in _dbus_type_writer_write_basic dbus/dbus/dbus-marshal-recursive.c:2327
    #3 0x7fdb943c52a6 in write_basic_field dbus/dbus/dbus-marshal-header.c:318
    #4 0x7fdb943c919e in _dbus_header_set_field_basic dbus/dbus/dbus-marshal-header.c:1321
    #5 0x7fdb943e1349 in dbus_message_set_reply_serial dbus/dbus/dbus-message.c:1173

Signed-off-by: Marc Mutz <marc@kdab.net>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98035
2016-10-04 11:22:25 +01:00
..
.gitignore Rename dbus-test to test-dbus to match common test application naming scheme. 2014-01-17 16:17:02 +00:00
dbus-address.c Merge branch 'dbus-1.6' 2013-07-01 12:16:05 +01:00
dbus-address.h Decorated public exported functions with DBUS_EXPORT macro, reviewed by Colin Walters. 2010-03-16 09:33:39 +01:00
dbus-arch-deps.h.in Remove support for platforms with no 64-bit integer type 2013-09-16 15:31:02 +01:00
dbus-asv-util.c New a{sv} helper for using byte arrays as the variant 2015-02-18 10:35:05 +00:00
dbus-asv-util.h New a{sv} helper for using byte arrays as the variant 2015-02-18 10:35:05 +00:00
dbus-auth-script.c Don't use _dbus_warn() for intentionally-skipped tests 2015-11-02 23:32:06 +01:00
dbus-auth-script.h Consistently include <config.h> in all C source files and never in header files. 2010-03-19 20:11:48 +01:00
dbus-auth-util.c Remove some redundant inclusions 2015-02-20 20:49:01 +00:00
dbus-auth.c Mark WaitingForOK state as unused 2016-08-12 10:11:31 +01:00
dbus-auth.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-bus.c Remove unnecessary dbus_setenv() 2013-11-01 12:08:33 +00:00
dbus-bus.h Decorated public exported functions with DBUS_EXPORT macro, reviewed by Colin Walters. 2010-03-16 09:33:39 +01:00
dbus-connection-internal.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-connection.c Make UUID generation failable 2015-05-14 14:30:30 +01:00
dbus-connection.h Revert "Use typedef DBusSocket for sockets fd's to avoid conversion warnings." 2015-03-11 15:42:51 +01:00
dbus-credentials-util.c Remove some redundant inclusions 2015-02-20 20:49:01 +00:00
dbus-credentials.c Add LSM-agnostic support for LinuxSecurityLabel credential 2015-02-18 10:35:05 +00:00
dbus-credentials.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-dataslot.c tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-dataslot.h Replace individual global-lock variables with an array of DBusRMutex * 2013-06-17 16:53:51 +01:00
dbus-errors.c _dbus_set_error_valist: add 2015-02-03 16:19:20 +00:00
dbus-errors.h Minor include file fix. 2010-06-07 15:34:22 +02:00
dbus-file-unix.c Fail to generate random bytes instead of falling back to rand() 2015-05-14 14:30:30 +01:00
dbus-file-win.c Fail to generate random bytes instead of falling back to rand() 2015-05-14 14:30:30 +01:00
dbus-file.c moved out dbus file related functions from sysdeps into separate files - tested on windows 2009-12-20 11:24:32 +01:00
dbus-file.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-hash.c Revert "Add new functions _dbus_hash_table_to_array() and _dbus_hash_table_from_array() from related activation code." 2016-02-12 15:24:55 +00:00
dbus-hash.h Revert "Add new functions _dbus_hash_table_to_array() and _dbus_hash_table_from_array() from related activation code." 2016-02-12 15:24:55 +00:00
dbus-init-win.cpp dbus_threads_init_default, dbus_threads_init: be safe to call at any time 2013-05-10 11:35:08 +01:00
dbus-internals.c Revert "Rename function string_array_length() to _dbus_string_array_length() and move it to dbus-internals.c." 2016-02-12 15:25:09 +00:00
dbus-internals.h On Windows make access to member 'refcount' of struct DBusBabysitter thread safe. 2016-05-13 13:39:30 +02:00
dbus-keyring.c Fail to generate random bytes instead of falling back to rand() 2015-05-14 14:30:30 +01:00
dbus-keyring.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-list.c tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-list.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-macros.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-mainloop.c Convert mostly DBUS_SOCKET_... and DBUS_POLLABLE_.. macros for more type safety. 2015-05-12 18:36:24 +01:00
dbus-mainloop.h Revert all changes since a36d4918a6 2012-01-04 17:44:23 +00:00
dbus-marshal-basic.c marshalling tests: fix an incorrect use of memcmp 2015-02-24 11:14:31 +00:00
dbus-marshal-basic.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-marshal-byteswap-util.c tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-marshal-byteswap.c Remove support for platforms with no 64-bit integer type 2013-09-16 15:31:02 +01:00
dbus-marshal-byteswap.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-marshal-header.c Doc: fix incorrect param names, missing params, non-exist params 2013-08-22 20:01:08 +01:00
dbus-marshal-header.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-marshal-recursive-util.c When generating random messages, exercise empty signature as intended 2015-01-06 22:45:27 +00:00
dbus-marshal-recursive.c reader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772, 54773). 2015-05-08 15:54:42 +01:00
dbus-marshal-recursive.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-marshal-validate-util.c marshal-validate: run all the tests instead of just the even ones 2016-02-08 17:43:50 +00:00
dbus-marshal-validate.c Revert all changes since a36d4918a6 2012-01-04 17:44:23 +00:00
dbus-marshal-validate.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-memory.c dbus_shutdown: document its effect on shared connections 2014-10-13 15:16:56 +01:00
dbus-memory.h Annotate dbus_malloc*() functions with __attribute__ malloc and __attribute__ alloc_size 2011-01-05 13:13:48 +00:00
dbus-mempool.c Fix incorrect sizeof in a Valgrind hint macro call. 2013-09-16 13:07:41 +01:00
dbus-mempool.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-message-factory.c tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-message-factory.h tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-message-internal.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-message-private.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-message-util.c Avoid reading beyond the length of a variable 2015-05-13 18:44:44 +01:00
dbus-message.c DBusMessage: Fix UB (misaligned access) in call to _dbus_header_set_field_basic() 2016-10-04 11:22:25 +01:00
dbus-message.h DBusMessageIter: eliminate padding on 64-bit platforms 2016-03-02 18:16:26 +00:00
dbus-misc.c Make UUID generation failable 2015-05-14 14:30:30 +01:00
dbus-misc.h Export dbus_setenv() as a utility function 2013-08-23 11:40:50 +01:00
dbus-nonce.c Fail to generate random bytes instead of falling back to rand() 2015-05-14 14:30:30 +01:00
dbus-nonce.h Convert miscellaneous socket APIs to DBusSocket 2015-05-12 18:35:38 +01:00
dbus-object-tree.c Revert "Rename function string_array_length() to _dbus_string_array_length() and move it to dbus-internals.c." 2016-02-12 15:25:09 +00:00
dbus-object-tree.h Revert all changes since a36d4918a6 2012-01-04 17:44:23 +00:00
dbus-pending-call-internal.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-pending-call.c Cleanup: polish verbose mode checking 2013-08-23 11:51:18 +01:00
dbus-pending-call.h Add and use DBUS_TIMEOUT_INFINITE and DBUS_TIMEOUT_USE_DEFAULT 2011-06-10 18:33:04 +01:00
dbus-pipe-unix.c Make dbus-daemon.exe --print-address work under Windows 2012-02-28 12:37:41 +00:00
dbus-pipe-win.c Make dbus-daemon.exe --print-address work under Windows 2012-02-28 12:37:41 +00:00
dbus-pipe.c Make dbus-daemon.exe --print-address work under Windows 2012-02-28 12:37:41 +00:00
dbus-pipe.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-protocol.h Revert "Add DBus method to return the AA context of a connection" 2015-02-18 20:57:08 +00:00
dbus-resources.c DBusCounter: add a mutex to protect the refcount and notify function 2015-05-05 12:30:30 +01:00
dbus-resources.h Revert all changes since a36d4918a6 2012-01-04 17:44:23 +00:00
dbus-server-debug-pipe.c _dbus_server_init_base: raise a DBusError 2015-05-14 14:30:30 +01:00
dbus-server-debug-pipe.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-server-launchd.c _dbus_server_new_for_socket: raise a DBusError 2015-05-14 14:30:30 +01:00
dbus-server-launchd.h Add launchd implementation. 2010-12-06 21:33:06 +01:00
dbus-server-protected.h _dbus_server_init_base: raise a DBusError 2015-05-14 14:30:30 +01:00
dbus-server-socket.c _dbus_server_init_base: raise a DBusError 2015-05-14 14:30:30 +01:00
dbus-server-socket.h _dbus_server_new_for_socket: raise a DBusError 2015-05-14 14:30:30 +01:00
dbus-server-unix.c Fail to generate random bytes instead of falling back to rand() 2015-05-14 14:30:30 +01:00
dbus-server-unix.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-server-win.c Remove duplicate nonce-tcp (service-side) transport on Windows 2012-06-05 12:18:23 +01:00
dbus-server-win.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-server.c Make UUID generation failable 2015-05-14 14:30:30 +01:00
dbus-server.h Decorated public exported functions with DBUS_EXPORT macro, reviewed by Colin Walters. 2010-03-16 09:33:39 +01:00
dbus-sha.c tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-sha.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-shared.h Add org.freedesktop.DBus.Verbose interface to dbus-daemon when compiled with DBUS_ENABLE_VERBOSE_MODE. 2015-02-13 11:20:21 +01:00
dbus-shell.c Doc: fix invalid usage of doxygen @param command 2013-06-20 13:15:22 +01:00
dbus-shell.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-signature.c Replace some runtime assertions with compile-time assertions 2014-09-15 12:22:23 +01:00
dbus-signature.h Revert all changes since a36d4918a6 2012-01-04 17:44:23 +00:00
dbus-socket-set-epoll.c DBusMainLoop, DBusSocketSet: work in terms of DBusPollable 2015-05-12 18:34:32 +01:00
dbus-socket-set-poll.c Convert mostly DBUS_SOCKET_... and DBUS_POLLABLE_.. macros for more type safety. 2015-05-12 18:36:24 +01:00
dbus-socket-set.c Add an implementation of DBusSocketSet using epoll 2011-06-13 17:30:40 +01:00
dbus-socket-set.h DBusMainLoop, DBusSocketSet: work in terms of DBusPollable 2015-05-12 18:34:32 +01:00
dbus-sockets-win.h Mostly remove the remnants of an older socket abstraction layer 2015-05-12 18:34:24 +01:00
dbus-spawn-win.c Fix ambiguous setup of DBusBabySitter struct member child_handle on Windows. 2016-05-16 12:52:25 +02:00
dbus-spawn.c activation: set children oom_score_adj to 0 2016-06-30 13:54:10 +01:00
dbus-spawn.h DBusBabysitter: change executable to log_name 2013-11-01 12:40:41 +00:00
dbus-string-private.h Revert all changes since a36d4918a6 2012-01-04 17:44:23 +00:00
dbus-string-util.c tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-string.c _dbus_string_append_printf_valist: avoid leaking copy of varargs 2015-01-29 12:09:40 +00:00
dbus-string.h Use new _dbus_string_get_length_uint() to avoid another -Wsign-compare 2015-03-04 18:40:10 +00:00
dbus-syntax.c Doc: fix incorrect param names, missing params, non-exist params 2013-08-22 20:01:08 +01:00
dbus-syntax.h Add dbus-syntax.[ch] 2012-02-24 12:43:55 +00:00
dbus-sysdeps-pthread.c Revert "Add a statically-initialized implementation of _dbus_lock() on glibc systems" 2013-08-30 17:31:16 +01:00
dbus-sysdeps-thread-win.c dbus_threads_init_default, dbus_threads_init: be safe to call at any time 2013-05-10 11:35:08 +01:00
dbus-sysdeps-unix.c _dbus_ensure_standard_fds: new function to ensure std* fds are open 2016-08-12 10:58:38 +01:00
dbus-sysdeps-unix.h _dbus_ensure_standard_fds: new function to ensure std* fds are open 2016-08-12 10:58:38 +01:00
dbus-sysdeps-util-unix.c DBusSystemLogSeverity: add DBUS_SYSTEM_LOG_WARNING 2014-11-18 19:13:29 +00:00
dbus-sysdeps-util-win.c Fix crash running test-syslog on windows/wine. 2015-10-27 13:52:10 +01:00
dbus-sysdeps-util.c tests to embedded tests: replaced in libdbus 2013-06-28 12:15:53 +01:00
dbus-sysdeps-win.c Windows _dbus_get_autolaunch_address: don't leak shm_name 2015-11-18 23:40:50 +01:00
dbus-sysdeps-win.h Make Windows dbus-daemon look for the config file we install 2015-09-20 13:48:28 +02:00
dbus-sysdeps-wince-glue.c Doc: fix incorrect param names, missing params, non-exist params 2013-08-22 20:01:08 +01:00
dbus-sysdeps-wince-glue.h Wrap OutputDebugString for Windows CE builds, and add cast for MSVC. 2010-07-19 10:32:08 +02:00
dbus-sysdeps.c Fail to generate random bytes instead of falling back to rand() 2015-05-14 14:30:30 +01:00
dbus-sysdeps.h On Windows make access to member 'refcount' of struct DBusBabysitter thread safe. 2016-05-13 13:39:30 +02:00
dbus-test-main.c embedded tests: accept and ignore --tap argument 2015-12-02 18:51:08 +00:00
dbus-test.c Rename dbus-test to test-dbus to match common test application naming scheme. 2014-01-17 16:17:02 +00:00
dbus-test.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-threads-internal.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-threads.c Revert "Add a statically-initialized implementation of _dbus_lock() on glibc systems" 2013-08-30 17:31:16 +01:00
dbus-threads.h Allow both recursive and non-recursive mutexes to be supplied 2012-02-21 14:41:28 +00:00
dbus-timeout.c Consistently include <config.h> in all C source files and never in header files. 2010-03-19 20:11:48 +01:00
dbus-timeout.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-transport-protected.h generic socket transport code: work in terms of DBusSocket 2015-05-12 18:35:24 +01:00
dbus-transport-socket.c Convert mostly DBUS_SOCKET_... and DBUS_POLLABLE_.. macros for more type safety. 2015-05-12 18:36:24 +01:00
dbus-transport-socket.h generic socket transport code: work in terms of DBusSocket 2015-05-12 18:35:24 +01:00
dbus-transport-unix.c Turn DBusSocket into a type-safe struct, preventing inappropriate conversion 2015-05-12 18:35:56 +01:00
dbus-transport-unix.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-transport-win.c Remove duplicate nonce-tcp (client side) transport on Windows 2012-06-05 12:17:58 +01:00
dbus-transport-win.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-transport.c generic socket transport code: work in terms of DBusSocket 2015-05-12 18:35:24 +01:00
dbus-transport.h generic socket transport code: work in terms of DBusSocket 2015-05-12 18:35:24 +01:00
dbus-types.h Remove support for platforms with no 64-bit integer type 2013-09-16 15:31:02 +01:00
dbus-userdb-util.c Make userdb cache as a built-in feature 2013-09-13 14:59:20 +01:00
dbus-userdb.c Make userdb cache as a built-in feature 2013-09-13 14:59:20 +01:00
dbus-userdb.h Add DBUS_PRIVATE_EXPORT decoration to symbols used by dbus-daemon or tests 2015-02-20 20:49:36 +00:00
dbus-uuidgen.c Make UUID generation failable 2015-05-14 14:30:30 +01:00
dbus-uuidgen.h Make UUID generation failable 2015-05-14 14:30:30 +01:00
dbus-valgrind-internal.h Fix building with newer Valgrind 2012-11-09 14:04:27 +00:00
dbus-watch.c Convert mostly DBUS_SOCKET_... and DBUS_POLLABLE_.. macros for more type safety. 2015-05-12 18:36:24 +01:00
dbus-watch.h DBusMainLoop, DBusSocketSet: work in terms of DBusPollable 2015-05-12 18:34:32 +01:00
dbus.h Add dbus-syntax.[ch] 2012-02-24 12:43:55 +00:00
Makefile.am Move session & system bus configuration to datadir, by default. 2015-05-27 11:49:34 +01:00
Version.in Link dbus-daemon and dbus-daemon-lauch-helper against libdbus 2015-02-20 20:49:45 +00:00
versioninfo.rc.in WIN32: add versioninfo, and export symbols 2009-12-01 08:36:26 +01:00