Commit e6fafd3d authored by Adam Jackson's avatar Adam Jackson 🎧
Browse files

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: default avatarJasper St. Pierre <&lt;jstpierre@mecheye.net>
Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent fe07ec19
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment