[Mesa-dev] [PATCH v2 1/2] egl/drm: Fix misused x and y offsets on swrast_put_image2() (v2)

Daniel Stone daniel at fooishbar.org
Wed Jul 19 11:00:20 UTC 2017


Hi,

On 19 July 2017 at 11:25, Gwan-gyeong Mun <elongbug at gmail.com> wrote:
> [...]
> And it adds limits of the height and the width on the copy region.
>
> [...]
> @@ -534,14 +560,32 @@ swrast_put_image2(__DRIdrawable *driDrawable,
> +   if (height > dri2_surf->base.Height - y)
> +      height = dri2_surf->base.Height - y;
> +
> +   if (width_bytes > internal_stride - x_bytes)
> +      width_bytes = internal_stride - x_bytes;

This all seems quite odd. Have you observed out-of-bounds co-ordinates
in practice? If so, we should fix them at a higher layer, rather than
silently quashing them down here. We can also check (x+width) against
bo->base.width, and (y+height) against bo->base.height, rather than
using bytes as a unit. But it would be good to understand where the
real problem comes from first.

The rest is a good fix though, thankyou!

Cheers,
Daniel


More information about the mesa-dev mailing list