Bug 1391 - xdm hangs in a loop when invalid xpm bitmap is used for logo
Summary: xdm hangs in a loop when invalid xpm bitmap is used for logo
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xdm (show other bugs)
Version: unspecified
Hardware: x86 (IA32) FreeBSD
: high normal
Assignee: Alan Coopersmith
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-15 08:10 UTC by Vaclav Rehak
Modified: 2006-02-24 10:15 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch for fixing infinite loop on invalid xpm files. (1.98 KB, patch)
2006-02-24 11:34 UTC, Costantino Leandro
no flags Details | Splinter Review

Description Vaclav Rehak 2004-09-15 08:10:16 UTC
I followed some parts of XDM configuration example at
http://www.bodenstab.org/xdm.html to change the appearance of my login screen.

I used this command to generate my xpm logo:
fig2dev -L xpm -m 0.5 /usr/share/examples/BSD_daemon/beastie.fig
/usr/X11R6/lib/X11/xdm/pixmaps/bsd.xpm
and applied the following patch to get transparent background:

  --- bsd.xpm.orig        Sun Nov 17 19:20:44 2002
  +++ bsd.xpm     Sun Nov 17 19:25:49 2002
  @@ -1,13 +1,12 @@
   /* XPM */
   static char *noname[] = {
   /* width height ncolors chars_per_pixel */
  -"212 231 7 1",
  +"212 231 6 1",
   /* colors */
   "  c #000000",
   ". c #00FFFF",
   "X c #D10000",
  -"o c #FFFFFF",
  +"o c none",
   "O c #00B000",
   "+ c #FFD700",
  -"@ c None",
   /* pixels */

I verified by gqview that the logo looked like I wanted it to be.

But when change the Xresoures file to contain line
xlogin*logoFileName: /usr/X11R6/lib/X11/xdm/pixmaps/bsd.xpm

and run xdm, it resets just after running X and it switches back to text console
and keeps switching between X and console forever giving me no other option than
to reset my machine (neither Ctrl-Alt-Backspace nor Ctrl-C works).

When I change the first line of my xpm file back to "212 231 7 1", everything
works as expected (even with the transparent background).

I would expect xdm to exit with an error message in case of invalid xpm file
instead of looping forever.

Output of 'xdm -debug 2 > xdm.log 2>&1' can be found at
http://openbsd.cz/~vasek/xdm.log
the xpm bitmap at http://openbsd.cz/~vasek/bsd.xpm
and X.org log at http://openbsd.cz/~vasek/Xorg.0.log

I consider the following line to be indication of the problem:

X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  14 (X_GetGeometry)
  Resource id in failed request:  0x0
  Serial number of failed request:  51
  Current serial number in output stream:  51
Manager wait returns pid: 540 sig 0 core 0 code 1
Display exited with REMANAGE_DISPLAY

I hope this description is informative enough to help you find out the problem.
Comment 1 Costantino Leandro 2006-02-24 11:34:10 UTC
Created attachment 4739 [details] [review]
Patch for fixing infinite loop on invalid xpm files.

The code section that load de xpm did not check the return value, and always
set true to valid xpm variable. 
Patch should be applied from xdm/ dir.

( remove my email and name if necessary from patch )
Comment 2 Alan Coopersmith 2006-02-24 13:26:43 UTC
Looks good - I'll check in soon.
Comment 3 Jim Gettys 2006-02-24 13:49:24 UTC
Well, we should ask the question:

Since Constantino has cared enough to generate a patch for xdm, does he want to
become its maintainer?
Comment 4 Alan Coopersmith 2006-02-25 05:12:23 UTC
Commited to CVS head - thanks for the fix!

(jg: how about CVS access to commit patches first, before going straight from
 bugzilla patch submitter to maintainer?)

Comment 5 Alan Coopersmith 2006-02-25 05:15:22 UTC
CVSROOT:	/cvs/xorg
Module name:	app
Changes by:	alanc@kemper.freedesktop.org	06/02/24 18:09:00

Log message:
  2006-02-24  Alan Coopersmith  <alan.coopersmith@sun.com>
  
  	* greeter/Login.c:
  	Bug #1391 <https://bugs.freedesktop.org/show_bug.cgi?id=1391>
  	Patch #4739 <https://bugs.freedesktop.org/attachment.cgi?id=4739>
  	xdm hangs in a loop when invalid xpm bitmap is used for logo
  	(Costantino Leandro <lcostantino@gmail.com>)

Modified files:
      app/xdm/:
        ChangeLog 
      app/xdm/greeter/:
        Login.c 
  
  Revision      Changes    Path
  1.27          +8 -0      app/xdm/ChangeLog
  http://cvs.freedesktop.org/xorg/app/xdm/ChangeLog
  1.3           +18 -7     app/xdm/greeter/Login.c
  http://cvs.freedesktop.org/xorg/app/xdm/greeter/Login.c


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.