[PATCH 1/3] dri3: Guard against buggy clients
Jasper St. Pierre
jstpierre at mecheye.net
Fri Dec 13 10:12:32 PST 2013
Reviewed-by: Jasper St. Pierre <jstpierre at mecheye.net>
On Fri, Dec 13, 2013 at 12:05 PM, Adam Jackson <ajax at redhat.com> wrote:
> 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.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
> dri3/dri3_screen.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
> index cf2735b..c880296 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;
> --
> 1.8.4.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
--
Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20131213/daab5365/attachment.html>
More information about the xorg-devel
mailing list