[FreeNX-kNX] Patches for some nxagent bugs

Mario Becroft mb at gem.win.co.nz
Sun Jan 25 22:05:02 UTC 2009


If you are having problems with openoffice.org or vmware, or maybe other
applications, drastically slowing down or hanging the X server, problems
with it hanging when the X server dies, or a crash in
ValidateOnePicture() (can happen when running firefox on some web
sites), then try the following patches. I have tested them for the past
2 weeks and the issues which I mentioned previously on this list are
definitely fixed. Or upgrade to the latest nx-x11 and nxagent components
from nomachine, which include these fixes.


--- nx-X11/programs/Xserver/os/utils.c-dist	2009-01-10 17:56:03.063467036 +1300
+++ nx-X11/programs/Xserver/os/utils.c	2009-01-10 18:04:16.761853744 +1300
@@ -1822,6 +1822,8 @@
     int pid;
 } *pidlist;
 
+static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
+
 pointer
 Popen(char *command, char *type)
 {
@@ -1843,6 +1845,9 @@
 	return NULL;
     }
 
+    /* Ignore the smart scheduler while this is going on */
+    old_alarm = signal(SIGALRM, SIG_IGN);
+
 #ifdef NX_TRANS_EXIT
     if (OsVendorStartRedirectErrorFProc != NULL) {
         OsVendorStartRedirectErrorFProc();
@@ -1853,6 +1858,12 @@
 	close(pdes[0]);
 	close(pdes[1]);
 	xfree(cur);
+#ifdef NX_TRANS_EXIT
+	if (OsVendorEndRedirectErrorFProc != NULL) {
+	    OsVendorEndRedirectErrorFProc();
+	}
+#endif
+	signal(SIGALRM, old_alarm);
 	return NULL;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
@@ -2076,6 +2087,9 @@
         OsVendorEndRedirectErrorFProc();
     }
 #endif
+    
+    signal(SIGALRM, old_alarm);
+    
     return pid == -1 ? -1 : pstat;
 }
 

--- nx-X11/lib/X11/XlibInt.c.NX.original       2008-11-05 12:09:01.000000000 +0100
+++ nx-X11/lib/X11/XlibInt.c   2009-01-07 12:42:30.000000000 +0100
@@ -1840,7 +1840,7 @@ _XSend (
         int congestion;
 #endif

-#ifdef AGENT_SERVER
+#ifdef NX_TRANS_SOCKET
         if (!size || (dpy->flags & XlibDisplayIOError))
         {
             if (dpy->flags & XlibDisplayIOError)


commit 71fc5b3e9309182978ead676965d65ca93a4e3b9
Author: Keith Packard <keithp at keithp.com>
Date:   Wed May 2 11:41:11 2007 +0200

    Fix for a divide by zero that can be triggered by a malicious client.
    
    Problem reported by Derek Abdine of rapid7.com. Thanks.

diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 4c67bcd..478a80f 100644
--- nx-X11/programs/Xserver/fb/fbtrap.c
+++ nx-X11/programs/Xserver/fb/fbtrap.c
@@ -117,6 +117,9 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
     RenderEdge	l, r;
     xFixed	t, b;
     
+    if (!xTrapezoidValid (trap))
+	return;
+
     fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
 
     width = pPicture->pDrawable->width;
diff --git a/render/renderedge.c b/render/renderedge.c
index 199ec22..c2ffabe 100644
--- nx-X11/programs/Xserver/render/renderedge.c
+++ nx-X11/programs/Xserver/render/renderedge.c
@@ -143,6 +143,7 @@ RenderEdgeInit (RenderEdge	*e,
     dx = x_bot - x_top;
     dy = y_bot - y_top;
     e->dy = dy;
+    e->dx = 0;
     if (dy)
     {
 	if (dx >= 0)
 


-- 
Mario Becroft <mb at gem.win.co.nz>



More information about the FreeNX-kNX mailing list