mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 12:50:04 +01:00
render: avoid NULL pointer dereference if PictureFindVisual returns NULL
Found by Oracle Parfait 13.3:
Null pointer dereference [null-pointer-deref]:
Read from null pointer pVisual
at line 257 of dix/colormap.c in function 'CreateColormap'.
Null pointer introduced at line 412 of render/picture.c in
function 'PictureFindVisual'.
Constant 'NULL' passed into function CreateColormap, argument
pVisual, from call at line 431 in function
'PictureInitIndexedFormat'.
Function PictureFindVisual may return constant 'NULL' at
line 412, called at line 429.
Fixes: d4a101d4e ("Integration of DAMAGE-XFIXES branch to trunk")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 7af077dd2f)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1767>
This commit is contained in:
parent
cec3e55ec9
commit
5406ddd003
1 changed files with 3 additions and 0 deletions
|
|
@ -427,6 +427,9 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
|
||||||
else {
|
else {
|
||||||
VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
|
VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
|
||||||
|
|
||||||
|
if (pVisual == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (CreateColormap(FakeClientID(0), pScreen, pVisual,
|
if (CreateColormap(FakeClientID(0), pScreen, pVisual,
|
||||||
&format->index.pColormap, AllocNone, 0)
|
&format->index.pColormap, AllocNone, 0)
|
||||||
!= Success)
|
!= Success)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue