From nobody@FreeBSD.org  Thu Jun 14 12:09:06 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6910416A478
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jun 2007 12:09:06 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 507D313C469
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jun 2007 12:09:06 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l5EC95uw088711
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jun 2007 12:09:05 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l5EC95kf088710;
	Thu, 14 Jun 2007 12:09:05 GMT
	(envelope-from nobody)
Message-Id: <200706141209.l5EC95kf088710@www.freebsd.org>
Date: Thu, 14 Jun 2007 12:09:05 GMT
From: "Rashid N. Achilov" <achilov-rn@askd.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: rdesktop crashes after upgrading X.Org to 7.2
X-Send-Pr-Version: www-3.0

>Number:         113678
>Category:       ports
>Synopsis:       net/rdesktop crashes after upgrading X.Org to 7.2
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 14 12:10:05 GMT 2007
>Closed-Date:    Tue Jun 19 08:55:39 GMT 2007
>Last-Modified:  Tue Jun 19 09:00:19 GMT 2007
>Originator:     Rashid N. Achilov
>Release:        6.2-RELEASE
>Organization:
LLC "AS-System Complex"
>Environment:
FreeBSD to-495.askd.ru 6.2-RELEASE FreeBSD 6.2-RELEASE #3: Fri Feb 16 18:47:32 NOVT 2007     root@to-495.askd.ru:/usr/obj/usr/src/sys/Sentry  i386

>Description:
After upgrading X.Org to 7.2 rdesktop constantly crash with 'Segmentation
Fault'. I have search web and have discovered, that is a common problem - that
was many bureports, but none for FreeBSD? :-O No any FreeBSD user uses rdesktop
with ordinary office box, when DRI disabled (when DRI runs, bug doesn't
occured) ? :-O I have found a parital solution on some Debian forum, where was
told, that X11 now check on sanity for some parameters at XCreateImage and
returns NULL, when not satisifed. Rdesktop is very old program, it does not
check any return codes. So, I have looked at source code, read a man for
XCreateImage and detect a call for XCreateImage, which throws an exception. So,
I have search web again and found a patch at Ubuntu forum (he-he, Linux again
:-) ). When I have applied a patch, bug was eliminated. Also I have added some
debug code to point to exception source.
>How-To-Repeat:
Run rdesktop and login to any server. After succesful login rdesktop will crash
>Fix:
Patch attached

Patch attached with submission follows:

--- xwin.c.old	Mon Aug  7 18:45:44 2006
+++ xwin.c	Thu Jun 14 18:57:28 2007
@@ -2341,6 +2341,12 @@
 	image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,
 			     (char *) tdata, width, height, bitmap_pad, 0);
 
+        if (!image)
+          {
+            puts("(ui_create_bitmap) XCreateImage returns NULL!");
+            exit(100);
+          }
+
 	XPutImage(g_display, bitmap, g_create_bitmap_gc, image, 0, 0, 0, 0, width, height);
 
 	XFree(image);
@@ -2372,6 +2378,12 @@
 	image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,
 			     (char *) tdata, width, height, bitmap_pad, 0);
 
+        if (!image)
+          {
+            puts("(ui_paint_bitmap) XCreateImage returns NULL!");
+            exit(100);
+          }
+
 	if (g_ownbackstore)
 	{
 		XPutImage(g_display, g_backstore, g_gc, image, 0, 0, x, y, cx, cy);
@@ -2414,6 +2426,13 @@
 
 	image = XCreateImage(g_display, g_visual, 1, ZPixmap, 0, (char *) data,
 			     width, height, 8, scanline);
+
+        if (!image)
+          {
+            puts("(ui_create_glyph) XCreateImage returns NULL!");
+            exit(100);
+          }
+
 	image->byte_order = MSBFirst;
 	image->bitmap_bit_order = MSBFirst;
 	XInitImage(image);
@@ -3219,7 +3238,13 @@
 		return;
 
 	image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,
-			     (char *) data, cx, cy, BitmapPad(g_display), cx * g_bpp / 8);
+			     (char *) data, cx, cy, g_bpp, 0);
+
+        if (!image)
+          {
+            puts("(ui_desktop_restore) XCreateImage returns NULL!");
+            exit(100);
+          }
 
 	if (g_ownbackstore)
 	{


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->obrien 
Responsible-Changed-By: pav 
Responsible-Changed-When: Thu Jun 14 15:09:52 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113678 
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Tue Jun 19 08:54:10 UTC 2007 
State-Changed-Why:  
Similar patch from different PR was committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113678 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/113678: commit references a PR
Date: Tue, 19 Jun 2007 08:55:19 +0000 (UTC)

 pav         2007-06-19 08:55:11 UTC
 
   FreeBSD ports repository
 
   Modified files:
     net/rdesktop         Makefile 
   Added files:
     net/rdesktop/files   patch-xwin.c 
   Log:
   - Fix a crash on login for people running on X.org 7.2 in 24-bit color depth
   
   PR:             ports/113216, ports/113678
   Submitted by:   Thomas Spreng <spreng@socket.ch>
   Approved by:    maintainer timeout (obrien; 18 days)
   
   Revision  Changes    Path
   1.41      +1 -1      ports/net/rdesktop/Makefile
   1.1       +11 -0     ports/net/rdesktop/files/patch-xwin.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
