50 lines
2.3 KiB
Diff
50 lines
2.3 KiB
Diff
From 4aaeda4cbfe4c1d3e3ca7166aac88679325ec560 Mon Sep 17 00:00:00 2001
|
||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||
Date: Sat, 20 Sep 2025 16:35:46 -0700
|
||
Subject: [PATCH xserver 06/31] panoramix: avoid null dereference in
|
||
PanoramiXMaybeAddDepth()
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Reported in #1817:
|
||
|
||
Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
|
||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:748:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘PanoramiXDepths’
|
||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:802:1: enter_function: entry to ‘PanoramiXConsolidate’
|
||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:813:17: branch_true: following ‘true’ branch...
|
||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: branch_true: ...to here
|
||
xwayland-24.1.6/redhat-linux-build/../Xext/panoramiX.c:814:9: call_function: calling ‘PanoramiXMaybeAddDepth’ from ‘PanoramiXConsolidate’
|
||
746| PanoramiXDepths = reallocarray(PanoramiXDepths,
|
||
747| PanoramiXNumDepths, sizeof(DepthRec));
|
||
748|-> PanoramiXDepths[j].depth = pDepth->depth;
|
||
749| PanoramiXDepths[j].numVids = 0;
|
||
750| PanoramiXDepths[j].vids = NULL;
|
||
|
||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||
(cherry picked from commit 537b56cccaf1759f9beef9396463b1f412614003)
|
||
(cherry picked from commit 9664b5532480ddb739e414e74e933691bbe36e85)
|
||
|
||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||
---
|
||
Xext/panoramiX.c | 4 ++--
|
||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||
|
||
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
|
||
index 71713f14b..c6d0e5183 100644
|
||
--- a/Xext/panoramiX.c
|
||
+++ b/Xext/panoramiX.c
|
||
@@ -743,8 +743,8 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
|
||
|
||
j = PanoramiXNumDepths;
|
||
PanoramiXNumDepths++;
|
||
- PanoramiXDepths = reallocarray(PanoramiXDepths,
|
||
- PanoramiXNumDepths, sizeof(DepthRec));
|
||
+ PanoramiXDepths = XNFreallocarray(PanoramiXDepths,
|
||
+ PanoramiXNumDepths, sizeof(DepthRec));
|
||
PanoramiXDepths[j].depth = pDepth->depth;
|
||
PanoramiXDepths[j].numVids = 0;
|
||
PanoramiXDepths[j].vids = NULL;
|
||
--
|
||
2.54.0
|
||
|