commit 05c8945e2595a2006adc940906f869d2bdf35534 Author: Samuel Thibault Date: Sat Feb 9 01:48:13 2019 +0100 drisw: check value returned by XGetGeometry Otherwise unitialized values would be returned. Signed-off-by: Samuel Thibault diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 00c7fa100a..e3af0a6152 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -172,7 +172,13 @@ swrastGetDrawableInfo(__DRIdrawable * draw, drawable = pdraw->xDrawable; - XGetGeometry(dpy, drawable, &root, x, y, &uw, &uh, &bw, &depth); + if (!XGetGeometry(dpy, drawable, &root, x, y, &uw, &uh, &bw, &depth)) { + *x = 0; + *y = 0; + uw = 0; + uh = 0; + } + *w = uw; *h = uh; } commit 52dc4370b91051fa6ad5f72c2f84e08448e67653 Author: Samuel Thibault Date: Sat Feb 9 01:46:43 2019 +0100 drisw: Fix unbound loop when drawable height is 0 Signed-off-by: Samuel Thibault diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c index 927ac39ce6..90223efdf4 100644 --- a/src/gallium/state_trackers/dri/drisw.c +++ b/src/gallium/state_trackers/dri/drisw.c @@ -396,7 +396,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, /* The pipe transfer has a pitch rounded up to the nearest 64 pixels. get_image() has a pitch rounded up to 4 bytes. */ ximage_stride = ((w * cpp) + 3) & -4; - for (line = h-1; line; --line) { + for (line = h-1; line > 0; --line) { memmove(&map[line * transfer->stride], &map[line * ximage_stride], ximage_stride);