summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-02-11 01:13:45 +0000
committerHavoc Pennington <hp@redhat.com>2005-02-11 01:13:45 +0000
commit71f3b461b371d6bf7c7bc4e92578420b78d5c0d8 (patch)
tree79ee6992bcea7df9d484feb61999b22ecf4c54ff /dbus
parentdf0c6408805341f1ac673430ce6e92f352a473e6 (diff)
2005-02-10 Havoc Pennington <hp@redhat.com>
* dbus/dbus-message-factory.c (generate_special): modify test to avoid using a non-basic dict key * dbus/dbus-marshal-validate-util.c: add test for the below * doc/dbus-specification.xml: require that dict keys are a basic type * dbus/dbus-marshal-validate.c (_dbus_validate_signature_with_reason): require that dict key is a basic type
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-marshal-validate-util.c3
-rw-r--r--dbus/dbus-marshal-validate.c4
-rw-r--r--dbus/dbus-marshal-validate.h1
-rw-r--r--dbus/dbus-message-factory.c10
-rw-r--r--dbus/dbus-test.c2
5 files changed, 13 insertions, 7 deletions
diff --git a/dbus/dbus-marshal-validate-util.c b/dbus/dbus-marshal-validate-util.c
index afaf5262..57caa7fc 100644
--- a/dbus/dbus-marshal-validate-util.c
+++ b/dbus/dbus-marshal-validate-util.c
@@ -92,7 +92,8 @@ static const ValidityTest signature_tests[] = {
{ "()i", DBUS_INVALID_STRUCT_HAS_NO_FIELDS },
{ "(a)", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
{ "a{ia}", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
- { "a{}", DBUS_INVALID_DICT_ENTRY_HAS_NO_FIELDS }
+ { "a{}", DBUS_INVALID_DICT_ENTRY_HAS_NO_FIELDS },
+ { "a{aii}", DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE },
/* { "a{i}", DBUS_INVALID_DICT_ENTRY_HAS_ONLY_ONE_FIELD }, */
/* { "{is}", DBUS_INVALID_DICT_ENTRY_NOT_INSIDE_ARRAY }, */
/* { "a{isi}", DBUS_INVALID_DICT_ENTRY_HAS_TOO_MANY_FIELDS }, */
diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c
index 1639fb83..8315bcce 100644
--- a/dbus/dbus-marshal-validate.c
+++ b/dbus/dbus-marshal-validate.c
@@ -155,6 +155,10 @@ _dbus_validate_signature_with_reason (const DBusString *type_str,
array_depth = 0;
}
+ if (last == DBUS_DICT_ENTRY_BEGIN_CHAR &&
+ !_dbus_type_is_basic (*p))
+ return DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE;
+
last = *p;
++p;
}
diff --git a/dbus/dbus-marshal-validate.h b/dbus/dbus-marshal-validate.h
index 74f4bbf2..29a528b5 100644
--- a/dbus/dbus-marshal-validate.h
+++ b/dbus/dbus-marshal-validate.h
@@ -109,6 +109,7 @@ typedef enum
DBUS_INVALID_DICT_ENTRY_HAS_ONLY_ONE_FIELD = 52,
DBUS_INVALID_DICT_ENTRY_HAS_TOO_MANY_FIELDS = 53,
DBUS_INVALID_DICT_ENTRY_NOT_INSIDE_ARRAY = 54,
+ DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE = 55,
DBUS_VALIDITY_LAST
} DBusValidity;
diff --git a/dbus/dbus-message-factory.c b/dbus/dbus-message-factory.c
index 37c3d38d..39df92f2 100644
--- a/dbus/dbus-message-factory.c
+++ b/dbus/dbus-message-factory.c
@@ -623,7 +623,7 @@ generate_special (DBusMessageDataIter *iter,
}
else if (item_seq == 16)
{
- char long_sig[DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*3+6];
+ char long_sig[DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*4+8];
const char *v_STRING;
int i;
int n_begins;
@@ -637,19 +637,19 @@ generate_special (DBusMessageDataIter *iter,
_dbus_assert_not_reached ("oom");
i = 0;
- while (i <= (DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*2 + 2))
+ while (i <= (DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*3 + 3))
{
long_sig[i] = DBUS_TYPE_ARRAY;
++i;
long_sig[i] = DBUS_DICT_ENTRY_BEGIN_CHAR;
++i;
+ long_sig[i] = DBUS_TYPE_INT32;
+ ++i;
}
- n_begins = i / 2;
+ n_begins = i / 3;
long_sig[i] = DBUS_TYPE_INT32;
++i;
- long_sig[i] = DBUS_TYPE_INT32;
- ++i;
while (n_begins > 0)
{
diff --git a/dbus/dbus-test.c b/dbus/dbus-test.c
index 4fdd8ced..e388310b 100644
--- a/dbus/dbus-test.c
+++ b/dbus/dbus-test.c
@@ -118,7 +118,7 @@ dbus_internal_do_not_use_run_tests (const char *test_data_dir)
check_memleaks ();
-#if 1
+#if 0
printf ("%s: running recursive marshalling tests\n", "dbus-test");
if (!_dbus_marshal_recursive_test ())
die ("recursive marshal");