x11/motif: avoid a bad out-of-bounds array access that crashes xpdf when
searching for non-UTF-7. Reported and tested by Walter Alejandro Iglesias ok matthieu
This commit is contained in:
parent
93f93db555
commit
a51c0bece1
@ -1,6 +1,7 @@
|
||||
COMMENT= Motif toolkit
|
||||
|
||||
DISTNAME= motif-2.3.8
|
||||
REVISION= 0
|
||||
|
||||
SHARED_LIBS += Xm 6.1 # 4.4
|
||||
SHARED_LIBS += Mrm 4.1 # 4.4
|
||||
|
24
x11/motif/patches/patch-lib_Xm_VirtKeys_c
Normal file
24
x11/motif/patches/patch-lib_Xm_VirtKeys_c
Normal file
@ -0,0 +1,24 @@
|
||||
Check bounds before accessing the keycaps table.
|
||||
|
||||
Index: lib/Xm/VirtKeys.c
|
||||
--- lib/Xm/VirtKeys.c.orig
|
||||
+++ lib/Xm/VirtKeys.c
|
||||
@@ -558,10 +558,16 @@ FindVirtKey(Display *dpy,
|
||||
XmDisplay xmDisplay = (XmDisplay) XmGetXmDisplay( dpy);
|
||||
XmVKeyBinding keyBindings = xmDisplay->display.bindings;
|
||||
KeyCode min_kcode;
|
||||
- int ks_per_kc;
|
||||
+ int min_kc, max_kc, ks_per_kc;
|
||||
KeySym *ks_table = XtGetKeysymTable( dpy, &min_kcode, &ks_per_kc);
|
||||
KeySym *kc_map = &ks_table[(keycode - min_kcode) * ks_per_kc];
|
||||
- Modifiers EffectiveSMMask = EffectiveStdModMask( dpy, kc_map, ks_per_kc);
|
||||
+ Modifiers EffectiveSMMask;
|
||||
+
|
||||
+ XDisplayKeycodes(dpy, &min_kc, &max_kc);
|
||||
+ if (keycode < min_kcode || (keycode - min_kcode) * ks_per_kc >= max_kc)
|
||||
+ return;
|
||||
+
|
||||
+ EffectiveSMMask = EffectiveStdModMask( dpy, kc_map, ks_per_kc);
|
||||
|
||||
/* Get the modifiers from the actual event */
|
||||
Modifiers VirtualStdMods = 0;
|
Loading…
x
Reference in New Issue
Block a user