Blame SOURCES/0001-present-Check-for-NULL-to-prevent-crash.patch

3f8e74
From 94b4a3d45451d29e9539ea234ce8b5e9ed58546c Mon Sep 17 00:00:00 2001
3f8e74
From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= <spaz16@wp.pl>
3f8e74
Date: Thu, 13 Jan 2022 00:47:27 +0100
3f8e74
Subject: [PATCH xserver] present: Check for NULL to prevent crash
3f8e74
MIME-Version: 1.0
3f8e74
Content-Type: text/plain; charset=UTF-8
3f8e74
Content-Transfer-Encoding: 8bit
3f8e74
3f8e74
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1275
3f8e74
Signed-off-by: Błażej Szczygieł <spaz16@wp.pl>
3f8e74
Tested-by: Aaron Plattner <aplattner@nvidia.com>
3f8e74
(cherry picked from commit 22d5818851967408bb7c903cb345b7ca8766094c)
3f8e74
---
3f8e74
 present/present_scmd.c | 6 ++++++
3f8e74
 1 file changed, 6 insertions(+)
3f8e74
3f8e74
diff --git a/present/present_scmd.c b/present/present_scmd.c
3f8e74
index 3c68e690b..11391adbb 100644
3f8e74
--- a/present/present_scmd.c
3f8e74
+++ b/present/present_scmd.c
3f8e74
@@ -168,6 +168,9 @@ present_scmd_get_crtc(present_screen_priv_ptr screen_priv, WindowPtr window)
3f8e74
     if (!screen_priv->info)
3f8e74
         return NULL;
3f8e74
 
3f8e74
+    if (!screen_priv->info->get_crtc)
3f8e74
+        return NULL;
3f8e74
+
3f8e74
     return (*screen_priv->info->get_crtc)(window);
3f8e74
 }
3f8e74
 
3f8e74
@@ -206,6 +209,9 @@ present_flush(WindowPtr window)
3f8e74
     if (!screen_priv->info)
3f8e74
         return;
3f8e74
 
3f8e74
+    if (!screen_priv->info->flush)
3f8e74
+        return;
3f8e74
+
3f8e74
     (*screen_priv->info->flush) (window);
3f8e74
 }
3f8e74
 
3f8e74
-- 
3f8e74
2.34.1
3f8e74