xserver: Branch 'master'

Brian Paul brianp at kemper.freedesktop.org
Sat Sep 23 19:38:20 EEST 2006


 hw/dmx/dmxcmap.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

New commits:
diff-tree f7c1d942416db8d0d4c5a21f5ece1ccacb926b69 (from 945b7c63946f5257d0f9b0dcf2f8f4882fb2c6f8)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Sep 23 10:38:10 2006 -0600

    Check for visual==NULL in dmxBECreateColormap() before calling XCreateColormap()
    to prevent potential segfault.

diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c
index b4279e7..9a9781f 100644
--- a/hw/dmx/dmxcmap.c
+++ b/hw/dmx/dmxcmap.c
@@ -40,6 +40,7 @@
 #endif
 
 #include "dmx.h"
+#include "dmxlog.h"
 #include "dmxsync.h"
 #include "dmxcmap.h"
 #include "dmxvisual.h"
@@ -83,12 +84,18 @@ Bool dmxBECreateColormap(ColormapPtr pCo
     VisualPtr           pVisual   = pColormap->pVisual;
     Visual             *visual    = dmxLookupVisual(pScreen, pVisual);
 
-    pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
-				      dmxScreen->scrnWin,
-				      visual,
-				      (pVisual->class & DynamicClass ?
-				       AllocAll : AllocNone));
-    return (pCmapPriv->cmap != 0);
+    if (visual) {
+       pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
+                                         dmxScreen->scrnWin,
+                                         visual,
+                                         (pVisual->class & DynamicClass ?
+                                          AllocAll : AllocNone));
+       return (pCmapPriv->cmap != 0);
+    }
+    else {
+       dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
+       return 0;
+    }
 }
 
 /** Create colormap on back-end server associated with \a pColormap's



More information about the xorg-commit mailing list