xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Feb 17 18:57:01 UTC 2025
hw/xfree86/dri/xf86dri.c | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
New commits:
commit 94d942267a6fb3663fed6e911dcaff7fb5e19cfe
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date: Thu Jul 18 18:33:40 2024 +0200
dri: report failed memory allocation
ProcXF86DRIGetDrawableInfo() should report failed memory allocation instead
of pretending everything's okay.
Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1797>
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index bf8b356ca..709420564 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -425,28 +425,25 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
/* Clip cliprects to screen dimensions (redirected windows) */
pClippedRects = xallocarray(rep.numClipRects, sizeof(drm_clip_rect_t));
- if (pClippedRects) {
- ScreenPtr pScreen = screenInfo.screens[stuff->screen];
- int i, j;
-
- for (i = 0, j = 0; i < rep.numClipRects; i++) {
- pClippedRects[j].x1 = max(pClipRects[i].x1, 0);
- pClippedRects[j].y1 = max(pClipRects[i].y1, 0);
- pClippedRects[j].x2 = min(pClipRects[i].x2, pScreen->width);
- pClippedRects[j].y2 = min(pClipRects[i].y2, pScreen->height);
-
- if (pClippedRects[j].x1 < pClippedRects[j].x2 &&
- pClippedRects[j].y1 < pClippedRects[j].y2) {
- j++;
- }
- }
+ if (!pClippedRects)
+ return BadAlloc;
- rep.numClipRects = j;
- }
- else {
- rep.numClipRects = 0;
+ ScreenPtr pScreen = screenInfo.screens[stuff->screen];
+ int i, j;
+
+ for (i = 0, j = 0; i < rep.numClipRects; i++) {
+ pClippedRects[j].x1 = max(pClipRects[i].x1, 0);
+ pClippedRects[j].y1 = max(pClipRects[i].y1, 0);
+ pClippedRects[j].x2 = min(pClipRects[i].x2, pScreen->width);
+ pClippedRects[j].y2 = min(pClipRects[i].y2, pScreen->height);
+
+ if (pClippedRects[j].x1 < pClippedRects[j].x2 &&
+ pClippedRects[j].y1 < pClippedRects[j].y2) {
+ j++;
+ }
}
+ rep.numClipRects = j;
rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
}
More information about the xorg-commit
mailing list