linux-capture: Fix possible null dereferences

Add checks for valid pointers when requesting the cursor information and
pixel data.
master
fryshorts 2015-01-13 22:19:47 +01:00
parent 6d2226bde8
commit e009c7951d
1 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,8 @@ static uint32_t *xcursor_pixels(XFixesCursorImage *xc) {
*/ */
static void xcursor_create(xcursor_t *data, XFixesCursorImage *xc) { static void xcursor_create(xcursor_t *data, XFixesCursorImage *xc) {
uint32_t *pixels = xcursor_pixels(xc); uint32_t *pixels = xcursor_pixels(xc);
if (!pixels)
return;
if (data->tex if (data->tex
&& data->last_height == xc->width && data->last_height == xc->width
@ -82,6 +84,8 @@ void xcursor_destroy(xcursor_t *data) {
void xcursor_tick(xcursor_t *data) { void xcursor_tick(xcursor_t *data) {
XFixesCursorImage *xc = XFixesGetCursorImage(data->dpy); XFixesCursorImage *xc = XFixesGetCursorImage(data->dpy);
if (!xc)
return;
if (!data->tex || data->last_serial != xc->cursor_serial) if (!data->tex || data->last_serial != xc->cursor_serial)
xcursor_create(data, xc); xcursor_create(data, xc);