[cairo] [PATCH] Fix width and height args for _cairo_xcb_connection_copy_area()

Maks Naumov maksqwe1 at ukr.net
Wed Aug 20 08:29:13 PDT 2014


Static analysis. So I don't have test cases for this typo.
Why it is wrong code? I looked in other places where width and height is obtained:

if (src->repeat) {
...
xcb_rects[i].width  = x2 - x1;
xcb_rects[i].height = y2 - y1;
}
else {
...
_cairo_xcb_connection_copy_area(dst->connection, src->pixmap, dst->drawable,
gc, src->x0 + x1, src->y0 + y1, x1, y1, x2 - x2, y2 - x2);
}

width = x2 - x2; == 0
height = y2 - x2; ???

So I decided send small patch.
P.S. I found new strange code, and soon will send a new patch.

> On 19.08.2014 23:59, Maks Naumov wrote:
> > Signed-off-by: Maks Naumov <maksqwe1 at ukr.net>
> > ---
> > src/cairo-xcb-surface-core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/cairo-xcb-surface-core.c b/src/cairo-xcb-surface-core.c
> > index 545fd28..9c0c0a0 100644
> > --- a/src/cairo-xcb-surface-core.c
> > +++ b/src/cairo-xcb-surface-core.c
> > @@ -573,7 +573,7 @@ _cairo_xcb_surface_core_copy_boxes (cairo_xcb_surface_t *dst,
> > src->x0 + x1,
> > src->y0 + y1,
> > x1, y1,
> > - x2 - x2, y2 - x2);
> > + x2 - x1, y2 - y1);
> > }
> > }
> > }
> > 
> 
> Ouch. How did you find this? Any particular test case that catches this?
> 
> I will run this through the test suite later, for now I am just curious about
> what you did to find this and why no one else did.
> 
> Uli
> -- 
> - Buck, when, exactly, did you lose your mind?
> - Three months ago. I woke up one morning married to a pineapple.
> An ugly pineapple... But I loved her.
>


More information about the cairo mailing list