diff options
| author | Kristian Høgsberg <krh@bitplanet.net> | 2011-01-26 11:46:05 -0500 |
|---|---|---|
| committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-01-26 11:46:05 -0500 |
| commit | f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de (patch) | |
| tree | 10ee37e5841bea6e042c345582070b73bccf99c4 /compositor | |
| parent | Screenshots were upside down (diff) | |
| download | wayland-f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de.tar wayland-f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de.tar.gz wayland-f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de.tar.bz2 wayland-f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de.tar.lz wayland-f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de.tar.xz wayland-f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de.tar.zst wayland-f9edadf3f2b1ddb138a7ad47a2a80d47ba6605de.zip | |
shm: Check width, height and stride for invalid values
Diffstat (limited to 'compositor')
| -rw-r--r-- | compositor/shm.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/compositor/shm.c b/compositor/shm.c index 913833e..389eeaa 100644 --- a/compositor/shm.c +++ b/compositor/shm.c @@ -97,9 +97,9 @@ shm_create_buffer(struct wl_client *client, struct wl_shm *shm, struct wlsc_compositor, shm); struct wlsc_shm_buffer *buffer; + /* FIXME: Define a real exception event instead of abusing the + * display.invalid_object error */ if (visual->object.interface != &wl_visual_interface) { - /* FIXME: Define a real exception event instead of - * abusing this one */ wl_client_post_event(client, (struct wl_object *) compositor->wl_display, WL_DISPLAY_INVALID_OBJECT, 0); @@ -108,6 +108,16 @@ shm_create_buffer(struct wl_client *client, struct wl_shm *shm, return; } + if (width < 0 || height < 0 || stride < width) { + wl_client_post_event(client, + (struct wl_object *) compositor->wl_display, + WL_DISPLAY_INVALID_OBJECT, 0); + fprintf(stderr, + "invalid width, height or stride in create_buffer\n"); + close(fd); + return; + } + buffer = malloc(sizeof *buffer); if (buffer == NULL) { close(fd); |
