ken@CS.ROCHESTER.EDU.UUCP (02/17/87)
There is a nil deref bug in xwd.c which shows up on Suns. Fix follows. Also I have a version of xpr for Imagens for people who are willing to be guinea pigs. Ken *** xwd.c.orig Mon Dec 1 20:17:54 1986 --- xwd.c Mon Feb 16 21:37:38 1987 *************** *** 26,31 * V5 padding at the end. Up to 16-bit displays are supported. I * don't yet know how 24- to 32-bit displays will be handled under * the Version 11 protocol. */ #ifndef lint --- 26,36 ----- * V5 padding at the end. Up to 16-bit displays are supported. I * don't yet know how 24- to 32-bit displays will be handled under * the Version 11 protocol. + * + * 2/16/87 Ken Yap + * - Bug if window has no name. Cannot defererence win_name on Suns + * because it holds a nil pointer. Fixed by assigning pointer to + * empty string to win_name. */ #ifndef lint *************** *** 195,200 Error("Can't query target window."); if(XFetchName(target_win, &win_name) == FAILURE) Error("Can't fetch target window name."); /* sizeof(char) is included for the null string terminator. */ win_name_size = strlen(win_name) + sizeof(char); --- 200,207 ----- Error("Can't query target window."); if(XFetchName(target_win, &win_name) == FAILURE) Error("Can't fetch target window name."); + if(win_name == NULL) + win_name = ""; /* sizeof(char) is included for the null string terminator. */ win_name_size = strlen(win_name) + sizeof(char);
kucharsk@uts.amdahl.com (William Kucharski) (11/06/89)
I've already sent this to xbugs, but thought I'd post it anyway: X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R3 CLIENT MACHINE and OPERATING SYSTEM: All DISPLAY: All WINDOW MANAGER: All AREA: xwd SYNOPSIS: The "-nobdrs" option does not work correctly. Also, trying to dump a window clipped in height by the root window will cause a invalid parameter error from XGetImage. DESCRIPTION: The logic in determining the window area to save when the "-nobdrs" option is selected is wrong, and would account for a window's border width too many times. Also, due to a typo in the code, a window's width would be adjusted if the height of the save area was clipped by the display size, resulting in an invalid width parameter. REPEAT BY: xwd -nobdrs > foo; xwud -in foo Place window partially off bottom of display; do an xwd dump of that window. SAMPLE FIX: *** xwd.c.orig Sun Nov 5 15:53:44 1989 --- xwd.c Sun Nov 5 15:55:10 1989 *************** *** 184,191 **** if(!XGetWindowAttributes(dpy, window, &win_info)) Fatal_Error("Can't get target window attributes."); ! absx = win_info.x + (nobdrs ? win_info.border_width : 0); ! absy = win_info.y + (nobdrs ? win_info.border_width : 0); width = win_info.width + (nobdrs ? 0 : (2 * win_info.border_width)); height = win_info.height + (nobdrs ? 0 : (2 * win_info.border_width)); dwidth = DisplayWidth (dpy, screen); --- 184,191 ---- if(!XGetWindowAttributes(dpy, window, &win_info)) Fatal_Error("Can't get target window attributes."); ! absx = win_info.x; ! absy = win_info.y; width = win_info.width + (nobdrs ? 0 : (2 * win_info.border_width)); height = win_info.height + (nobdrs ? 0 : (2 * win_info.border_width)); dwidth = DisplayWidth (dpy, screen); *************** *** 195,201 **** if (absx < 0) width += absx, absx = 0; if (absy < 0) height += absy, absy = 0; if (absx + width > dwidth) width = dwidth - absx; ! if (absy + height > dheight) width = dheight - absy; XFetchName(dpy, window, &win_name); if (!win_name || !win_name[0]) --- 195,201 ---- if (absx < 0) width += absx, absx = 0; if (absy < 0) height += absy, absy = 0; if (absx + width > dwidth) width = dwidth - absx; ! if (absy + height > dheight) height = dheight - absy; XFetchName(dpy, window, &win_name); if (!win_name || !win_name[0]) -- =============================================================================== | ARPA: kucharsk@uts.amdahl.com | William Kucharski | | UUCP: ...!{ames,apple,sun,uunet}!amdahl!kucharsk | Amdahl Corporation | =============================================================================== | Saying: "It's a window system named 'X,' NOT a system named 'X Windows'" | =============================================================================== | Disclaimer: "The opinions expressed above may not agree with mine at any | | other moment in time, so they certainly can't be those of my | | employer." | ===============================================================================