From e87b0d95ea71f767b94e226f8256d95c5bb2bdf3 Mon Sep 17 00:00:00 2001 From: Coues Ludovic Date: Wed, 30 Oct 2013 18:23:41 +0100 Subject: [PATCH] Check if cursor image is empty --- cursor/parse_cursor_file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cursor/parse_cursor_file.c b/cursor/parse_cursor_file.c index 30f7df5..9b70f9f 100644 --- a/cursor/parse_cursor_file.c +++ b/cursor/parse_cursor_file.c @@ -164,6 +164,11 @@ int parse_cursor_file(xcb_cursor_context_t *c, const int fd, xcint_image_t **ima free(cf.tocs); return -EINVAL; } + /* Image surface can't be null */ + if (i->width * i->height == 0) { + free(cf.tocs); + return -EINVAL; + } numpixels = i->width * i->height; i->pixels = malloc(numpixels * sizeof(uint32_t)); read(fd, i->pixels, numpixels * sizeof(uint32_t)); -- 1.8.4.2