summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2013-12-13 11:28:59 -0500
committerAdam Jackson <ajax@redhat.com>2013-12-13 14:58:40 -0500
commite6fafd3de70d315130fb6e5732cfd02a5901b788 (patch)
tree66422ef2448c20e37667e1222b5e5513871f1ece
parentfe07ec19e212a68076560d243a2a935c54589068 (diff)
dri3: Guard against buggy clients
There's nothing to stop a client from sending these requests to screens without DRI3 support, and if they do, we'll crash. Let's not do that. Reviewed-by: Jasper St. Pierre <<jstpierre@mecheye.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--dri3/dri3_screen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index cf2735b8d..c88029612 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -55,6 +55,9 @@ dri3_pixmap_from_fd(PixmapPtr *ppixmap, ScreenPtr screen, int fd,
dri3_screen_info_ptr info = ds->info;
PixmapPtr pixmap;
+ if (!info || !info->pixmap_from_fd)
+ return BadImplementation;
+
pixmap = (*info->pixmap_from_fd) (screen, fd, width, height, stride, depth, bpp);
if (!pixmap)
return BadAlloc;
@@ -71,6 +74,9 @@ dri3_fd_from_pixmap(int *pfd, PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
dri3_screen_info_ptr info = ds->info;
int fd;
+ if (!info || !info->fd_from_pixmap)
+ return BadImplementation;
+
fd = (*info->fd_from_pixmap)(screen, pixmap, stride, size);
if (fd < 0)
return BadAlloc;