diff options
| author | Daniel Stone <daniel@fooishbar.org> | 2012-07-23 19:54:41 +0100 |
|---|---|---|
| committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-07-23 20:16:57 -0400 |
| commit | db0add6d5e23deac53c834f73d5e56180600cead (patch) | |
| tree | 11b872eaaad1c99c168ebf26e8f0e0cbc6444c20 /src/connection.c | |
| parent | Unstatic arg_count_for_signature and get_next_argument (diff) | |
| download | wayland-db0add6d5e23deac53c834f73d5e56180600cead.tar wayland-db0add6d5e23deac53c834f73d5e56180600cead.tar.gz wayland-db0add6d5e23deac53c834f73d5e56180600cead.tar.bz2 wayland-db0add6d5e23deac53c834f73d5e56180600cead.tar.lz wayland-db0add6d5e23deac53c834f73d5e56180600cead.tar.xz wayland-db0add6d5e23deac53c834f73d5e56180600cead.tar.zst wayland-db0add6d5e23deac53c834f73d5e56180600cead.zip | |
Make NEW_IDs nullable
The connection-handling code already allows this, so make it legal in
the protocol definition too.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'src/connection.c')
| -rw-r--r-- | src/connection.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/connection.c b/src/connection.c index b228c92..4ba7f63 100644 --- a/src/connection.c +++ b/src/connection.c @@ -532,6 +532,10 @@ wl_closure_vmarshal(struct wl_object *sender, object = va_arg(ap, struct wl_object *); if (end - p < 1) goto err; + + if (!arg.nullable && object == NULL) + goto err_null; + *p++ = object ? object->id : 0; break; @@ -719,6 +723,15 @@ wl_connection_demarshal(struct wl_connection *connection, extra += sizeof *object; closure->args[i] = object; + if (*p == 0 && !arg.nullable) { + printf("NULL new ID received on non-nullable " + "type, message %s(%s)\n", message->name, + message->signature); + *object = NULL; + errno = EINVAL; + goto err; + } + *object = wl_map_lookup(objects, *p); if (*object == WL_ZOMBIE_OBJECT) { /* references object we've already @@ -751,6 +764,14 @@ wl_connection_demarshal(struct wl_connection *connection, closure->args[i] = id; *id = p; + if (*id == 0 && !arg.nullable) { + printf("NULL new ID received on non-nullable " + "type, message %s(%s)\n", message->name, + message->signature); + errno = EINVAL; + goto err; + } + if (wl_map_reserve_new(objects, *p) < 0) { printf("not a valid new object id (%d), " "message %s(%s)\n", @@ -935,7 +956,17 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send) fprintf(stderr, "nil"); break; case 'n': - fprintf(stderr, "new id %u", value->uint32); + fprintf(stderr, "new id %s@", + (closure->message->types[i - 2]) ? + closure->message->types[i - 2]->name : + "[unknown]"); + if (send && value->new_id != 0) + fprintf(stderr, "%u", value->new_id); + else if (!send && value->object != NULL) + fprintf(stderr, "%u", + *((uint32_t *)value->object)); + else + fprintf(stderr, "nil"); break; case 'a': fprintf(stderr, "array"); |
