Xext: panoramix: extra safety checks

Even though risk of being actually hit is minimal, better having some extra
safety checks instead of segfaulting, just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-06 19:13:07 +02:00
parent 3f7370d53f
commit 2b3bbce30b
2 changed files with 8 additions and 3 deletions

View File

@ -1264,11 +1264,15 @@ XineramaGetImageData(DrawablePtr *pDrawables,
for (j = 0, index = (pitch * y) + x, index2 = 0; j < h;
j++, index += pitch, index2 += ScratchPitch) {
if (w) {
if (!shift)
if (!shift) {
assert(ScratchMem);
memcpy(data + index, ScratchMem + index2, w);
else
}
else {
assert(ScratchMem);
CopyBits(data + index, shift,
ScratchMem + index2, w);
}
}
if (leftover) {
@ -1288,6 +1292,7 @@ XineramaGetImageData(DrawablePtr *pDrawables,
w *= j;
for (j = 0; j < h; j++) {
assert(ScratchMem);
memcpy(data + (pitch * (y + j)) + x,
ScratchMem + (ScratchPitch * j), w);
}

View File

@ -1136,7 +1136,7 @@ PanoramiXCopyArea(ClientPtr client)
}
free(data);
if (pGC->graphicsExposures) {
if (pGC && pGC->graphicsExposures) {
RegionRec rgn;
int dx, dy;
BoxRec sourceBox;