[PATCH] dmx: Fix null pointer dereference

Tobias Stoeckmann tobias at stoeckmann.org
Sun Mar 12 15:19:47 UTC 2017


On Sun, Mar 12, 2017 at 03:47:50PM +0100, walter harms wrote:
> why not patch TimerForce() and solve the problem for once and any one ?

I didn't do it because I am not sure about the implied consequences of
simply accepting NULL. Maybe it's not meant to be used that way.

But here's the alternative possibility.
---
 os/WaitFor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/os/WaitFor.c b/os/WaitFor.c
index 613608faf..ab5f8a3b8 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -261,7 +261,7 @@ AdjustWaitForDelay(void *waitTime, int newdelay)
 }
 
 static inline Bool timer_pending(OsTimerPtr timer) {
-    return !xorg_list_is_empty(&timer->list);
+    return timer != NULL && !xorg_list_is_empty(&timer->list);
 }
 
 /* If time has rewound, re-run every affected timer.
-- 
2.12.0



More information about the xorg-devel mailing list