From f53a2af83e141012fc6c4f70c53244d1af018339 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 10 Jun 2011 14:00:19 +0100 Subject: [PATCH 7/9] _dbus_type_writer_init: do not allow initialization without type_str Also assert about other preconditions, for clarity. --- dbus/dbus-marshal-recursive.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c index 5e9070e..e8cc20f 100644 --- a/dbus/dbus-marshal-recursive.c +++ b/dbus/dbus-marshal-recursive.c @@ -1494,6 +1494,16 @@ _dbus_type_writer_init (DBusTypeWriter *writer, DBusString *value_str, int value_pos) { + _dbus_assert (writer != NULL); + _dbus_assert (byte_order == DBUS_BIG_ENDIAN || + byte_order == DBUS_LITTLE_ENDIAN); + _dbus_assert (type_str != NULL); + _dbus_assert (type_pos >= 0); + _dbus_assert (type_pos <= _dbus_string_get_length (type_str)); + _dbus_assert (value_str != NULL); + _dbus_assert (value_pos >= 0); + _dbus_assert (value_pos <= _dbus_string_get_length (value_str)); + writer->byte_order = byte_order; writer->type_str = type_str; writer->type_pos = type_pos; -- 1.7.6.3