mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
panoramix: avoid null dereference in PanoramiXMaybeAddDepth()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/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> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2065>
This commit is contained in:
committed by
Enrico Weigelt
parent
2ee7e9bc92
commit
0616df4a76
@@ -726,8 +726,8 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
|
||||
|
||||
int 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;
|
||||
|
||||
Reference in New Issue
Block a user