[PATCH] _NET_WORKAREA is interpreted wrong on 64-bit machines (-g workarea)
Michael Stapelberg <[email protected]>
| Newsgroups | gmane.network.rdesktop.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, when testing -g workarea on my computer, I noticed that while the hint is set correctly by the wm (_NET_WORKAREA(CARDINAL) = 0, 0, 1280, 800 according to xprop), rdesktop tried to open a window with width == height == 0, which does not work and will lead to a BadValue error. The problem is that in rdesktop, sizeof(uint32_t) == sizeof(long) is assumed when interpreting the result of XGetWindowProperty. XGetWindowProperty(3) says: If the returned format is 8, the returned data is represented as a char array. If the returned format is 16, the returned data is represented as a short array and should be cast to that type to obtain the elements. If the returned format is 32, the returned data is represented as a long array and should be cast to that type to obtain the elements. However, in ewmhints.c in get_current_workarea(), return_words is declared as uint32_t, which is only 4 bytes long instead of 8 bytes. A patch to fix this is attached to this email. Best regards, Michael PS: You can also find this problem at https://bugs.launchpad.net/ubuntu/+source/rdesktop/+bug/192218 ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ rdesktop-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdesktop-devel
rdesktop-workarea-64bit.patch
(application/octet-stream, 661 B)
--- O.ewmhints.c 2009-12-31 17:42:59.519052114 +0100 +++ ewmhints.c 2009-12-31 17:43:12.510583263 +0100 @@ -135,7 +135,7 @@ int current_desktop; unsigned long nitems_return; unsigned char *prop_return; - uint32 *return_words; + long *return_words; const uint32 net_workarea_x_offset = 0; const uint32 net_workarea_y_offset = 1; const uint32 net_workarea_width_offset = 2; @@ -158,7 +158,7 @@ if (current_desktop < 0) return -1; - return_words = (uint32 *) prop_return; + return_words = (long *) prop_return; *x = return_words[current_desktop * 4 + net_workarea_x_offset]; *y = return_words[current_desktop * 4 + net_workarea_y_offset];