1. 13 Oct, 2016 1 commit
    • Simon McVittie's avatar
      Be more const-correct · 8db5ca90
      Simon McVittie authored
      As a general design principle, strings that we aren't going to modify
      should usually be const. When compiling with -Wwrite-strings, quoted
      string constants are of type "const char *", causing compiler warnings
      when they are assigned to char * variables.
      
      Unfortunately, we need to add casts in a few places:
      
      * _dbus_list_append(), _dbus_test_oom_handling() and similar generic
        "user-data" APIs take a void *, not a const void *, so we have
        to cast
      * For historical reasons the execve() family of functions take a
        (char * const *), i.e. a constant pointer to an array of mutable
        strings, so again we have to cast
      * _dbus_spawn_async_with_babysitter similarly takes a char **,
        although we can make it a little more const-correct by making it
        take (char * const *) like execve() does
      
      This also incorporates a subsequent patch by Thomas Zimmermann to
      put various string constants in static storage, which is a little
      more efficient.
      Signed-off-by: default avatarSimon McVittie <smcv@debian.org>
      Reviewed-by: default avatarThomas Zimmermann <tdz@users.sourceforge.net>
      Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97357
      8db5ca90
  2. 10 Oct, 2016 8 commits
  3. 05 Oct, 2016 1 commit
  4. 04 Oct, 2016 1 commit
    • Marc Mutz's avatar
      DBusMessage: Fix UB (misaligned access) in call to _dbus_header_set_field_basic() · 178872ea
      Marc Mutz authored
      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: default avatarMarc Mutz <marc@kdab.net>
      Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
      Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98035
      178872ea
  5. 30 Sep, 2016 6 commits
  6. 15 Aug, 2016 1 commit
  7. 12 Aug, 2016 3 commits
  8. 11 Aug, 2016 7 commits
  9. 25 Jul, 2016 3 commits
  10. 23 Jul, 2016 1 commit
  11. 01 Jul, 2016 1 commit
  12. 30 Jun, 2016 1 commit
  13. 20 May, 2016 1 commit
  14. 16 May, 2016 3 commits
  15. 13 May, 2016 2 commits