aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIan Douglas Scott <idscott@system76.com>2022-07-12 09:12:33 -0700
committerIan Douglas Scott <idscott@system76.com>2022-07-14 08:10:38 -0700
commit13b05c9ed1570765923a28b277ca385001c2b5c6 (patch)
treee24e90ad5257b49943c81fb8d5560742a0a8d44b /tests
parentAdd release.sh (diff)
downloadwayland-13b05c9ed1570765923a28b277ca385001c2b5c6.tar
wayland-13b05c9ed1570765923a28b277ca385001c2b5c6.tar.gz
wayland-13b05c9ed1570765923a28b277ca385001c2b5c6.tar.bz2
wayland-13b05c9ed1570765923a28b277ca385001c2b5c6.tar.lz
wayland-13b05c9ed1570765923a28b277ca385001c2b5c6.tar.xz
wayland-13b05c9ed1570765923a28b277ca385001c2b5c6.tar.zst
wayland-13b05c9ed1570765923a28b277ca385001c2b5c6.zip
Do not allow nullable arrays, which were not correctly implemented
Nullable arrays, which are not used anywhere, were marshalled the same way as an empty non-null array. The demarshalling logic did not recognize anything as a null array. Given this, it seems better to just explicitly not support it. Fixes https://gitlab.freedesktop.org/wayland/wayland/-/issues/306. Signed-off-by: Ian Douglas Scott <idscott@system76.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/connection-test.c10
-rw-r--r--tests/message-test.c6
2 files changed, 2 insertions, 14 deletions
diff --git a/tests/connection-test.c b/tests/connection-test.c
index eea9287..592e27e 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -305,7 +305,6 @@ TEST(connection_marshal_nullables)
{
struct marshal_data data;
struct wl_object object;
- struct wl_array array;
const char text[] = "curry";
setup_marshal_data(&data);
@@ -317,9 +316,6 @@ TEST(connection_marshal_nullables)
marshal(&data, "?o", 12, NULL);
assert(data.buffer[2] == 0);
- marshal(&data, "?a", 12, NULL);
- assert(data.buffer[2] == 0);
-
marshal(&data, "?s", 12, NULL);
assert(data.buffer[2] == 0);
@@ -327,12 +323,6 @@ TEST(connection_marshal_nullables)
marshal(&data, "?o", 12, &object);
assert(data.buffer[2] == object.id);
- array.data = (void *) text;
- array.size = sizeof text;
- marshal(&data, "?a", 20, &array);
- assert(data.buffer[2] == array.size);
- assert(memcmp(&data.buffer[3], text, array.size) == 0);
-
marshal(&data, "?s", 20, text);
assert(data.buffer[2] == sizeof text);
assert(strcmp((char *) &data.buffer[3], text) == 0);
diff --git a/tests/message-test.c b/tests/message-test.c
index 4e69392..40293a9 100644
--- a/tests/message-test.c
+++ b/tests/message-test.c
@@ -64,8 +64,7 @@ TEST(message_count_arrays)
{ "multiple", "aaiufaasonhaa", NULL },
{ "leading_version", "2aaiufaasonhaa", NULL },
{ "among_nullables", "iufsa?oa?nah", NULL },
- { "nullable", "?aiufs?a?onh?a", NULL },
- { "all_mixed", "2?aiufas?oa?na", NULL },
+ { "all_mixed", "2aiufas?oa?na", NULL },
};
const struct {
const struct wl_message *message;
@@ -81,8 +80,7 @@ TEST(message_count_arrays)
{ &fake_messages[5], 6 },
{ &fake_messages[6], 6 },
{ &fake_messages[7], 3 },
- { &fake_messages[8], 3 },
- { &fake_messages[9], 4 },
+ { &fake_messages[8], 4 },
};
for (i = 0; i < ARRAY_LENGTH(messages); ++i) {