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

Eric Engestrom eric.engestrom at imgtec.com
Wed Jul 19 13:41:26 UTC 2017


On Wednesday, 2017-07-19 12:00:20 +0100, Daniel Stone wrote:
> 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.

That's a good point. I rebased his patches on top of my gbm patch,
sending the series in a minute.

I've taken the opportunity to split the clamp change into its own patch,
so that the discussion relating to it can carry on independently of the
rest of the changes (including where that clamping should be done).

> 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.

We still need the byte values for the memcpy() and `dst`.

> 
> The rest is a good fix though, thankyou!
> 
> Cheers,
> Daniel


More information about the mesa-dev mailing list