On 26.02.2013 04:35, Peter Hutterer wrote:
Test case: xts5/XI/DeviceBell (1/6)

Reported-by: Knut Petersen <[email protected]>
Signed-off-by: Peter Hutterer <[email protected]>
---
  Xi/devbell.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Xi/devbell.c b/Xi/devbell.c
index c75b94d..d4c9554 100644
--- a/Xi/devbell.c
+++ b/Xi/devbell.c
@@ -142,7 +142,9 @@ ProcXDeviceBell(ClientPtr client)
          newpercent = base + newpercent;
      else
          newpercent = base - newpercent + stuff->percent;
-    (*proc) (newpercent, dev, ctrl, class);
+
+    if (proc)
+        (*proc) (newpercent, dev, ctrl, class);
return Success;

Still return Success?
Minutes ago I prepared the attached alternative ...

cu,
 Knut

  }

>From 4f358019c9727ed96b8cdac689991681843bcc2d Mon Sep 17 00:00:00 2001
From: Knut Petersen <[email protected]>
Date: Tue, 26 Feb 2013 07:52:59 +0100
Subject: [PATCH] Never try to execute BellProcPtr NULL.

This prevents xts XI/XDeviceBell-2 test
from segfaulting the server.

Signed-off-by: Knut Petersen <[email protected]>
---
 Xi/devbell.c |    3 ++-
 1 Datei geändert, 2 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/Xi/devbell.c b/Xi/devbell.c
index c75b94d..202c8de 100644
--- a/Xi/devbell.c
+++ b/Xi/devbell.c
@@ -142,7 +142,8 @@ ProcXDeviceBell(ClientPtr client)
         newpercent = base + newpercent;
     else
         newpercent = base - newpercent + stuff->percent;
+    if (proc == NULL)
+        return BadValue;
     (*proc) (newpercent, dev, ctrl, class);
-
     return Success;
 }
-- 
1.7.10.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to