cdesktopenv/cde
Marcin Cieslak 48b76f8623 dtcreate: Don't crash when clicking "Find Set..."
dtcreate crashed on 64-bit system when clicking
"Find Set.." button.

Crash happens in libXm:

    new_w=0x805db4300, args=0x7fffffffb430, num_args=0x7fffffffb3dc)
    at Form.c:1955

$1 = {att = {{type = 4 '\004', w = 0x805db3700, percent = 0, offset = 0,
      value = 0, tempValue = 0}, {type = 1 '\001', w = 0x0, percent = 0,
      offset = 10, value = 0, tempValue = 0}, {type = 3 '\003',
      w = 0x805db3700, percent = 0, offset = 0, value = 0, tempValue = 0}, {
      type = 3 '\003', w = 0x800000000, percent = 0, offset = 10, value = 0,
      tempValue = 0}}, next_sibling = 0x0, sorted = 0 '\0',
  resizable = 1 '\001', preferred_width = 0, preferred_height = 0}

(...)

    at icon_selection_dialog.c:1768
1767            /* Creation of icon_scrolled_win */
1768            icon_scrolled_win = XtVaCreateManagedWidget( "icon_scrolled_win",
1769                            xmScrolledWindowWidgetClass,
1770                            icon_selection_dialog,
1771                            XmNscrollingPolicy, XmAUTOMATIC,
1772    /*                      XmNnavigationType, XmTAB_GROUP, */
1773                            XmNx, 282,
1774                            XmNy, 84,
1775                            XmNscrollBarDisplayPolicy, XmAS_NEEDED,
1776                            XmNrightOffset, 10,
1777                            XmNrightAttachment, XmATTACH_FORM,
1778                            XmNtopOffset, 0,
1779                            XmNtopWidget, icon_container_label,
1780                            XmNtopAttachment, XmATTACH_WIDGET,
1781                            XmNleftOffset, 0,
1782                            XmNleftWidget, icon_container_label,
1783                            XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
1784                            XmNbottomOffset, 10,
1785                            XmNbottomWidget, XmATTACH_NONE,
1786                            XmNbottomAttachment, XmATTACH_WIDGET,
1787                            NULL );

What happens here is that ConstraintInitialize receives
four constraints, the last one is this:

    { type = 3 '\003', /* XmATTACH_WIDGET */
      w = 0x800000000, /* malformed XmATTACH_NONE ???
      percent = 0,
      offset = 10, /* specified as XmNbottomOffset */
      value = 0,
      tempValue = 0}

XmATTACH_* values are defined in <Xm/Xm.h> as follows:

   505  enum{   XmATTACH_NONE,                  XmATTACH_FORM,
   506          XmATTACH_OPPOSITE_FORM,         XmATTACH_WIDGET,
   507          XmATTACH_OPPOSITE_WIDGET,       XmATTACH_POSITION,
   508          XmATTACH_SELF
   509          } ;

What is not clear to why XmATTACH_NONE - which should be (int)0 -
becomes 0x800000000 - looks like a 64 bit bug somewhere.

Providing a long value on None (0L) as in this change fixes the
problem.

I understand is that it possible to use such an "empty" widget
is to create additional space at the bottom of the newly created
"icon_scrolled_win".

What needs to be clarified - shouldn't be such an (int) value be
automatically promoted to (long) (or XtArgVal, XtPointer, ...)
and preserve the value 0? Lots of parameters seem to be
passed as ints (for example dimensions) and they do not
appear to cause any trouble.
2012-09-30 11:11:21 -06:00
..
admin Install /usr/local/libdata/ldconfig/cde for FreeBSD 2012-09-25 11:33:09 -06:00
config Add csu objects to shared libraries on OpenBSD. 2012-09-25 11:37:23 -06:00
contrib contrib/xinetd: xinetd file for cmsd and ttsdbserver 2012-09-23 19:32:17 -06:00
databases Dtlogin logo for FreeBSD 2012-09-25 11:35:29 -06:00
doc Process sgml and man files in doc directory for FreeBSD. 2012-08-15 15:56:03 -06:00
examples 2 warnings fixed (64-bit) 2012-09-24 18:35:24 -06:00
historical historical: mv some old files that we want to preserve out of the top level 2012-08-10 07:17:27 -06:00
imports/motif message catalogs: fix comment lines, also remove linux hack in merge.c 2012-09-03 15:12:57 -06:00
include XmPrivate.h: never try to build this automatically. 2012-09-29 20:46:27 -06:00
lib dthelp: Avoid undefined behaviour in strcpy 2012-09-29 19:21:27 -06:00
logs
osf Correction of paths for BSDs 2012-08-29 20:39:02 -06:00
programs dtcreate: Don't crash when clicking "Find Set..." 2012-09-30 11:11:21 -06:00
util
.gitignore Allow building on FreeBSD 2012-09-06 11:17:43 -06:00
CONTRIBUTORS Update CONTRIBUTORS file. 2012-09-05 19:38:24 -06:00
COPYING Addition of LGPL file at top level, deprecation of file copyright, and 2012-05-29 16:54:57 +01:00
HISTORY add HISTORY file 2012-09-06 13:33:58 -06:00
Imakefile Imakefile diffs for OpenBSD. 2012-08-11 19:23:43 -06:00
Makefile Increment CDE version number to 2.2.0 2012-07-16 15:23:40 +01:00
README Update README file 2012-09-06 12:12:15 -06:00
copyright Add in a CONTRIBUTORS file for all people that have made changes post 2012-07-24 15:23:16 +01:00

README

*************************************

The Common Desktop Environment is released under the terms of the LGPL
V.2 license. You may reuse and redistribute this code under the terms
of this license. See the COPYING file for details.

*************************************
Purpose of this release:

This release of CDE under a new opensource license is numbered
starting at version 2.2.0.

************************************
Downloading this release:

CDE may be downloaded in source form from the Common Desktop
Environment website:

http://sourceforge.net/projects/cdesktopenv/

Or via git:

git clone git://git.code.sf.net/p/cdesktopenv/code cdesktopenv-code

The git repository will always be more up to date than the
downloadable tarballs we make available, so if you have problems,
please try the latest version from git master.

************************************
Installing this release:

Complete build and installation instructions can be found on the CDE
wiki:

http://sourceforge.net/p/cdesktopenv/wiki/Home/

Please go there and read the appropriate section(s) for your OS (Linux
or FreeBSD/OpenBSD/NetBSD currently).  There are a variety of
dependancies that must be met, as well as specific set up steps
required to build.

Do not expect to just type 'make' and have it actually work without
meeting the prerequisites and following the correct steps as spelled
out on the wiki. :)

There are also a lot of other documents and information there that you
might find useful.

************************************
Support: 

You can join the development mailing list here:

https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

There is a CDE IRC channel on chat.freenode.net, channel #cde

Bug reports and patches encouraged.