summaryrefslogtreecommitdiff
path: root/hw/kdrive
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2017-03-14 15:22:32 +0100
committerAdam Jackson <ajax@redhat.com>2017-03-15 15:36:52 -0400
commitb0ce1d088a863492f5de11e4dbde10af4261d892 (patch)
tree07ed6b168b81ead3d92d5ab4310b37e4de39009b /hw/kdrive
parentf40ff18c96e02ff18a367bf53feeb4bd8ee952a0 (diff)
Xephyr: Check screen resources creation success
If the screen pixmap or the corresponding texture creation with glamor fails, exit cleanly with an error message instead of segfaulting. Fixes: https://bugzilla.redhat.com/1431633 Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Diffstat (limited to 'hw/kdrive')
-rw-r--r--hw/kdrive/ephyr/ephyr.c6
-rw-r--r--hw/kdrive/ephyr/hostx.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 4eec72af9..ef5350e18 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -725,8 +725,10 @@ ephyrCreateResources(ScreenPtr pScreen)
ephyrShadowUpdate, ephyrWindowLinear);
else {
#ifdef GLAMOR
- if (ephyr_glamor)
- ephyr_glamor_create_screen_resources(pScreen);
+ if (ephyr_glamor) {
+ if (!ephyr_glamor_create_screen_resources(pScreen))
+ return FALSE;
+ }
#endif
return ephyrSetInternalDamage(pScreen);
}
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index fe69f84ae..a9ea3726d 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1559,6 +1559,8 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
pScreen->height,
pScreen->rootDepth,
GLAMOR_CREATE_NO_LARGE);
+ if (!screen_pixmap)
+ return FALSE;
pScreen->SetScreenPixmap(screen_pixmap);
if (pScreen->root && pScreen->SetWindowPixmap)
@@ -1566,6 +1568,9 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
/* Tell the GLX code what to GL texture to read from. */
tex = glamor_get_pixmap_texture(screen_pixmap);
+ if (!tex)
+ return FALSE;
+
ephyr_glamor_set_texture(scrpriv->glamor, tex);
return TRUE;