Dear WindowMaker developers,
first of all, thank you very much for your development of WindowMaker!:) I use
WMaker probably about 20 years and I still don't miss any feature, WindowMaker
is for me just perfect as is.
Last few weeks I had a problem on my 32bit Gentoo with WindowMaker 0.95.7. If I
tried to open window menu, the wmaker has restarted (crashed) and it has shown
no window menu. I have investigated a little bit and tried to start wmaker with
option --for-real and then I could see Segmentation fault. I have set ulimit
for core dumps to unlimited and created core dump. In gdb I could find the
the place, where wmaker segfaults.
Core was generated by `/home/tmp/wmaker/0.95.7/bin/wmaker --for-real -display
:1'.
Program terminated with signal SIGSEGV, Segmentation fault.
---Type <return> to continue, or q <return> to quit---
#0 0x0809a2c4 in updateWorkspaceMenu (menu=menu@entry=0x8b63c20) at
winmenu.c:381
381 entry->rtext = GetShortcutKey(wKeyBindings[WKBD_MOVE_WORKSPACE1 + i]);
The whole function updateWorkspaceMenu() from wmaker-0.95.7:
/**************************************************/
357 static void updateWorkspaceMenu(WMenu * menu)
358 {
359 WScreen *scr = menu->frame->screen_ptr;
360 char title[MAX_WORKSPACENAME_WIDTH + 1];
361 WMenuEntry *entry;
362 int i;
363
364 for (i = 0; i < scr->workspace_count; i++) {
365 if (i < menu->entry_no) {
366
367 entry = menu->entries[i];
368 if (strcmp(entry->text, scr->workspaces[i]->name) != 0) {
369 wfree(entry->text);
370 strncpy(title, scr->workspaces[i]->name, MAX_WORKSPACENAME_WIDTH);
371 title[MAX_WORKSPACENAME_WIDTH] = 0;
372 menu->entries[i]->text = wstrdup(title);
373 menu->entries[i]->rtext =
GetShortcutKey(wKeyBindings[WKBD_MOVE_WORKSPACE1 + i]);
374 menu->flags.realized = 0;
375 }
376 } else {
377 strncpy(title, scr->workspaces[i]->name, MAX_WORKSPACENAME_WIDTH);
378 title[MAX_WORKSPACENAME_WIDTH] = 0;
379
380 entry = wMenuAddCallback(menu, title, switchWSCommand, NULL);
381 entry->rtext = GetShortcutKey(wKeyBindings[WKBD_MOVE_WORKSPACE1 + i]);
382
383 menu->flags.realized = 0;
384 }
385
386 /* workspace shortcut labels */
387 if (i / 10 == scr->current_workspace / 10)
388 entry->rtext = GetShortcutKey(wKeyBindings[WKBD_MOVE_WORKSPACE1 + (i
% 10)]);
389 else
390 entry->rtext = NULL;
391 }
392
393 if (!menu->flags.realized)
394 wMenuRealize(menu);
395 }
/**************************************************/
As you can see the line 381 contains wKeyBindings[WKBD_MOVE_WORKSPACE1 + i].
The same code is on the line 373, but the line 388 contains
wKeyBindings[WKBD_MOVE_WORKSPACE1 + (i % 10)].
I have checked wKeyBindings in keybind.h too and wKeyBindings is defined as
array of WShortKey with "WKBD_LAST" items. The WKBD_LAST is the last item in
enum, which is at most 78 (i.e. 79 items from 0 to 78):
extern WShortKey wKeyBindings[WKBD_LAST];
This confirms GDB too:
(gdb) printf "WKBD_LAST:%i WKBD_MOVE_WORKSPACE1:%i i:%i
WKBD_MOVE_WORKSPACE1+i=%i\n",WKBD_LAST,WKBD_MOVE_WORKSPACE1,i,WKBD_MOVE_WORKSPACE1+i
WKBD_LAST:78 WKBD_MOVE_WORKSPACE1:49 i:59 WKBD_MOVE_WORKSPACE1+i=108
And if the code is "WKBD_MOVE_WORKSPACE1 + i", then I get total 108, which is
out of bound. Yes, I have many desktops, I just like the freedom to open new
clean desktop if someone comes and want from me something. I had 60, now only
50 as workaround for this segfault.
I am no developer, but IMHO, on the lines 373 and 381 there should be the same
index "WKBD_MOVE_WORKSPACE1 + (i % 10)" as on the line 388. Am I correct?
I cannot explain, why this segfault happens with 60 desktops. With 59 desktops
I get no segfault. But probably the index 107 (WKBD_MOVE_WORKSPACE1+58) stays
in the windowmaker's memory.
Funny thing is, that Debian Jessie with Windowmaker 0.95.5 and Debian Stretch
with Windowmaker 0.95.7 do not crash even with 60 desktops, but as I verified
in GDB, the code generates the index out of bound too. Maybe there must be more
desktops on Debian to generate enough big index and trigger this segfault or
maybe I have on my gentoo some feature, which place the data somewhere at the
end of windowmaker's memory and therefore I get segfault with 60 desktops.
As I can see, this bug is present since
commit ae7235c2df819604f2b407cc738a835f55e6b81f
Author: Iain Patterson <[email protected]>
Date: Wed Mar 27 22:46:00 2013 +0000
Could some please verify this and update this code?
Thank you very much.
Regards.
Robert Wolf.
--
To unsubscribe, send mail to [email protected].