File: max8

package info (click to toggle)
xkeycaps 2.47-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,268 kB
  • sloc: ansic: 40,772; sh: 132; makefile: 11
file content (61 lines) | stat: -rw-r--r-- 3,429 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
The code only deals with 8 names per key, but unfortunately doesn't expose that
number as a constant that is easily changed. Clip to 8 so we don't segfault.

 Program received signal SIGSEGV, Segmentation fault.
 strlen () at ../sysdeps/x86_64/strlen.S:106
 106	../sysdeps/x86_64/strlen.S: Datei oder Verzeichnis nicht gefunden.
 (gdb) bt
 #0  strlen () at ../sysdeps/x86_64/strlen.S:106
 #1  0x00007ffff6a2fa45 in __GI__IO_fputs (
     str=str@entry=0x7fff0000000a <error: Cannot access memory at address 0x7fff0000000a>,
     fp=fp@entry=0x5555559f6da0) at iofputs.c:33
 #2  0x00005555555dc2a4 in fprintf (__fmt=0x5555555e49e1 "%s", __stream=<optimized out>)
     at /usr/include/x86_64-linux-gnu/bits/stdio2.h:97
 #3  button_write (button=<optimized out>, client_data=<optimized out>,
     call_data=<optimized out>) at commands.c:629
 #4  0x00007ffff7944aad in ?? () from /usr/lib/x86_64-linux-gnu/libXt.so.6
 #5  0x00007ffff7944f15 in ?? () from /usr/lib/x86_64-linux-gnu/libXt.so.6
 #6  0x00007ffff7945bdd in _XtTranslateEvent () from /usr/lib/x86_64-linux-gnu/libXt.so.6
 #7  0x00007ffff791def2 in XtDispatchEventToWidget () from /usr/lib/x86_64-linux-gnu/libXt.so.6
 #8  0x00007ffff791e8dd in ?? () from /usr/lib/x86_64-linux-gnu/libXt.so.6
 #9  0x00007ffff791e9b9 in XtDispatchEvent () from /usr/lib/x86_64-linux-gnu/libXt.so.6
 #10 0x00005555555d2d96 in xkeycaps_main_loop (app=0x5555559a81a0, keyboard=<optimized out>)
     at xkeycaps.c:232
 #11 main (argc=<optimized out>, argv=<optimized out>) at xkeycaps.c:355
 (gdb) f 3
 #3  button_write (button=<optimized out>, client_data=<optimized out>,
     call_data=<optimized out>) at commands.c:629
 629		  fprintf (out, "%s", differences[i].names[j]);
 (gdb) p i
 $1 = 1
 (gdb) p j
 $2 = 9
 (gdb) p differences
 $3 = {{key = 0x555555a0dde0, count = 3, names = {0x7ffff6e13fc6 <_XkeyTable+134> "Escape",
       0x5555555e4448 "NoSymbol", 0x7ffff6e13fc6 <_XkeyTable+134> "Escape", 0x0,
       0x1d7 <error: Cannot access memory at address 0x1d7>,
       0x1000 <error: Cannot access memory at address 0x1000>,
       0x8 <error: Cannot access memory at address 0x8>,
       0x5a42ab91 <error: Cannot access memory at address 0x5a42ab91>}}, {key = 0x555555a0dfa0,
     count = 10, names = {0x7ffff6e144be <_XkeyTable+1406> "F1",
       0x7ffff6e144be <_XkeyTable+1406> "F1", 0x7ffff6e144be <_XkeyTable+1406> "F1",
       0x7ffff6e144be <_XkeyTable+1406> "F1", 0x7ffff6e144be <_XkeyTable+1406> "F1",
       0x7ffff6e144be <_XkeyTable+1406> "F1",
       0x7ffff6e1dfaf <_XkeyTable+41071> "XF86Switch_VT_1",
       0x7ffff6e144be <_XkeyTable+1406> "F1"}}, {key = 0x555555a0e160, count = 10, names = {
       0x7ffff6e144c7 <_XkeyTable+1415> "F2", 0x7ffff6e144c7 <_XkeyTable+1415> "F2",
       0x7ffff6e144c7 <_XkeyTable+1415> "F2", 0x7ffff6e144c7 <_XkeyTable+1415> "F2",
       0x7ffff6e144c7 <_XkeyTable+1415> "F2", 0x7ffff6e144c7 <_XkeyTable+1415> "F2",
       0x7ffff6e1dfc5 <_XkeyTable+41093> "XF86Switch_VT_2",
       0x7ffff6e144c7 <_XkeyTable+1415> "F2"}},

--- a/commands.c
+++ b/commands.c
@@ -440,6 +440,7 @@ button_write (button, client_data, call_
 	      keysyms = XGetKeyboardMapping (XtDisplay (widget),
 					     key->key.keycode,
 					     1, &count);
+	      if (count > 8) count = 8; /* FIXME: we are only prepared for 8 names per key, clip here */
 	      if (! keysyms) count = 0;
 	      all [all_count].key = key;
 	      for (; count > 0; count--)