(!1970) 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 f39873ed90
commit 66b9c32fd5
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; for (j = 0, index = (pitch * y) + x, index2 = 0; j < h;
j++, index += pitch, index2 += ScratchPitch) { j++, index += pitch, index2 += ScratchPitch) {
if (w) { if (w) {
if (!shift) if (!shift) {
assert(ScratchMem);
memcpy(data + index, ScratchMem + index2, w); memcpy(data + index, ScratchMem + index2, w);
else }
else {
assert(ScratchMem);
CopyBits(data + index, shift, CopyBits(data + index, shift,
ScratchMem + index2, w); ScratchMem + index2, w);
}
} }
if (leftover) { if (leftover) {
@ -1288,6 +1292,7 @@ XineramaGetImageData(DrawablePtr *pDrawables,
w *= j; w *= j;
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
assert(ScratchMem);
memcpy(data + (pitch * (y + j)) + x, memcpy(data + (pitch * (y + j)) + x,
ScratchMem + (ScratchPitch * j), w); ScratchMem + (ScratchPitch * j), w);
} }

View File

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