···11+commit 5579ae02a6b44f3072955f3e2f3249d2bd1201e4
22+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
33+Date: Sun Jul 10 15:49:43 2022 -0700
44+55+ xmodmap 1.0.11
66+77+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
88+99+commit 34df50af33d38621ce5d5a5510c7a4e70e1c17c1
1010+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
1111+Date: Sun Apr 17 10:34:10 2022 -0700
1212+1313+ PrintModifierMapping: stop leaking the map returned by XGetKeyboardMapping
1414+1515+ Resolves issue reported by Oracle Parfait static analyzer:
1616+1717+ Error: Memory leak
1818+ Memory leak [memory-leak] (CWE 401):
1919+ Memory leak of pointer pointer allocated with XGetKeyboardMapping(...)
2020+ at line 251 of app/xmodmap/exec.c in function 'PrintModifierMapping'.
2121+ pointer allocated at line 222 with XGetKeyboardMapping(...)
2222+2323+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2424+2525+commit 10eecbe868b5c898ea9cd05d014fbf13c29c3a26
2626+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
2727+Date: Sun Apr 17 10:19:58 2022 -0700
2828+2929+ handle.c: avoid leaks when realloc() fails
3030+3131+ Resolves issues reported by Oracle Parfait static analyzer:
3232+3333+ Error: Memory leak
3434+ Memory leak [memory-leak] (CWE 401):
3535+ Memory leak of pointer kclist allocated with malloc((n * 1))
3636+ at line 698 of app/xmodmap/handle.c in function 'do_remove'.
3737+ kclist allocated at line 662 with malloc((n * 1))
3838+ kclist leaks when num_kcs != 0 at line 676
3939+ and (j + 1) >= num_kcs at line 687
4040+ and (nc + num_kcs) > tot at line 691
4141+ and (num_kcs - 1) < 0 at line 701.
4242+ Memory leak [memory-leak] (CWE 401):
4343+ Memory leak of pointer kclist allocated with malloc((n * 1))
4444+ at line 711 of app/xmodmap/handle.c in function 'do_remove'.
4545+ kclist allocated at line 662 with malloc((n * 1))
4646+ kclist leaks when (i + 1) >= n at line 672.
4747+ Error: Memory leak
4848+ Memory leak [memory-leak] (CWE 401):
4949+ Memory leak of pointer kclist allocated with realloc(kclist, (tot * 1))
5050+ at line 711 of app/xmodmap/handle.c in function 'do_remove'.
5151+ kclist allocated at line 693 with realloc(kclist, (tot * 1))
5252+ kclist leaks when (num_kcs - 1) < 0 at line 701
5353+ and (i + 1) >= n at line 672.
5454+5555+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
5656+5757+commit d14cb47d9e9a10d04b1a7de9d2799fef9b0436e0
5858+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
5959+Date: Tue Dec 7 12:36:29 2021 -0800
6060+6161+ Build xz tarballs instead of bzip2
6262+6363+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
6464+6565+commit 90e2004549d79093ef7e1c17f99e64331c3e6661
6666+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
6767+Date: Tue Dec 7 12:36:27 2021 -0800
6868+6969+ gitlab CI: add a basic build test
7070+7171+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
7272+7373+commit fa9c38e6e7f1caa12d38f35c5633735bcaef3ba1
7474+Author: Karl Fogel <kfogel@red-bean.com>
7575+Date: Sat Mar 16 21:29:04 2019 -0500
7676+7777+ Fix warning about number of mouse buttons
7878+7979+ Change a warning to distinguish between too few buttons and too many.
8080+8181+ Before this change:
8282+8383+ $ xmodmap -e "pointer = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
8484+ Warning: Only changing the first 15 of 10 buttons.
8585+ $
8686+8787+ After this change:
8888+8989+ $ xmodmap -e "pointer = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
9090+ Warning: Not changing 5 extra buttons beyond 10.
9191+ $
9292+9393+ Fixes: https://gitlab.freedesktop.org/xorg/app/xmodmap/issues/2
9494+ Signed-off-by: Karl Fogel <kfogel@red-bean.com>
9595+196commit c5a5fb06fd25c044f343f4571c645fd6c954d038
297Author: Alan Coopersmith <alan.coopersmith@oracle.com>
398Date: Tue Feb 19 15:33:29 2019 -0800
···193288 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
194289195290commit bf4620e2d78d2a4766948f136f2372a596ac275d
196196-Author: Stéphane Aulery <lkppo@free.fr>
291291+Author: Stéphane Aulery <lkppo@free.fr>
197292Date: Sun Jun 30 01:50:58 2013 +0200
198293199294 error in manpage example about swapping Control_L/Caps_Lock keys
···762857 Use sed to fill in variables in man page
763858764859commit c4483b314106bcd2bb13e49650cfd279f74da73e
765765-Author: Kristian Høgsberg <krh@redhat.com>
860860+Author: Kristian Høgsberg <krh@redhat.com>
766861Date: Wed Sep 28 19:28:15 2005 +0000
767862768863 Copy bits from COPYING here.
···790885 Add build system for xmodmap Add xmodmap to build script
791886792887commit 9145de293109ba96fc8b97ac59c16c51b992f416
793793-Author: Kristian Høgsberg <krh@redhat.com>
888888+Author: Kristian Høgsberg <krh@redhat.com>
794889Date: Thu Nov 11 15:37:01 2004 +0000
795890796891 Fix #1818
···814909 4637857 - fix by Sam Lau)
815910816911commit ce64b2b312a73b9a4f266da8810ab552af4fbb1e
817817-Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
912912+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
818913Date: Fri Oct 15 00:44:08 2004 +0000
819914820915 Thu Oct 14 20:43:03 2004 Søren Sandmann <sandmann@redhat.com>
···11#! /bin/sh
22# Wrapper for compilers which do not understand '-c -o'.
3344-scriptversion=2012-10-14.11; # UTC
44+scriptversion=2018-03-07.03; # UTC
5566-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
66+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
77# Written by Tom Tromey <tromey@cygnus.com>.
88#
99# This program is free software; you can redistribute it and/or modify
···1717# GNU General Public License for more details.
1818#
1919# You should have received a copy of the GNU General Public License
2020-# along with this program. If not, see <http://www.gnu.org/licenses/>.
2020+# along with this program. If not, see <https://www.gnu.org/licenses/>.
21212222# As a special exception to the GNU General Public License, if you
2323# distribute this file as part of a program that contains a
···5353 MINGW*)
5454 file_conv=mingw
5555 ;;
5656- CYGWIN*)
5656+ CYGWIN* | MSYS*)
5757 file_conv=cygwin
5858 ;;
5959 *)
···6767 mingw/*)
6868 file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
6969 ;;
7070- cygwin/*)
7070+ cygwin/* | msys/*)
7171 file=`cygpath -m "$file" || echo "$file"`
7272 ;;
7373 wine/*)
···255255 echo "compile $scriptversion"
256256 exit $?
257257 ;;
258258- cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
258258+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
259259+ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
259260 func_cl_wrapper "$@" # Doesn't return...
260261 ;;
261262esac
···339340# Local Variables:
340341# mode: shell-script
341342# sh-indentation: 2
342342-# eval: (add-hook 'write-file-hooks 'time-stamp)
343343+# eval: (add-hook 'before-save-hook 'time-stamp)
343344# time-stamp-start: "scriptversion="
344345# time-stamp-format: "%:y-%02m-%02d.%02H"
345345-# time-stamp-time-zone: "UTC"
346346+# time-stamp-time-zone: "UTC0"
346347# time-stamp-end: "; # UTC"
347348# End:
+27-15
app/xmodmap/configure
···11#! /bin/sh
22# Guess values for system-dependent variables and create Makefiles.
33-# Generated by GNU Autoconf 2.69 for xmodmap 1.0.10.
33+# Generated by GNU Autoconf 2.69 for xmodmap 1.0.11.
44#
55# Report bugs to <https://gitlab.freedesktop.org/xorg/app/xmodmap/issues>.
66#
···581581# Identity of this package.
582582PACKAGE_NAME='xmodmap'
583583PACKAGE_TARNAME='xmodmap'
584584-PACKAGE_VERSION='1.0.10'
585585-PACKAGE_STRING='xmodmap 1.0.10'
584584+PACKAGE_VERSION='1.0.11'
585585+PACKAGE_STRING='xmodmap 1.0.11'
586586PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xmodmap/issues'
587587PACKAGE_URL=''
588588···733733docdir
734734oldincludedir
735735includedir
736736+runstatedir
736737localstatedir
737738sharedstatedir
738739sysconfdir
···816817sysconfdir='${prefix}/etc'
817818sharedstatedir='${prefix}/com'
818819localstatedir='${prefix}/var'
820820+runstatedir='${localstatedir}/run'
819821includedir='${prefix}/include'
820822oldincludedir='/usr/include'
821823docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
···10681070 | -silent | --silent | --silen | --sile | --sil)
10691071 silent=yes ;;
1070107210731073+ -runstatedir | --runstatedir | --runstatedi | --runstated \
10741074+ | --runstate | --runstat | --runsta | --runst | --runs \
10751075+ | --run | --ru | --r)
10761076+ ac_prev=runstatedir ;;
10771077+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
10781078+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
10791079+ | --run=* | --ru=* | --r=*)
10801080+ runstatedir=$ac_optarg ;;
10811081+10711082 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
10721083 ac_prev=sbindir ;;
10731084 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
···12051216for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12061217 datadir sysconfdir sharedstatedir localstatedir includedir \
12071218 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
12081208- libdir localedir mandir
12191219+ libdir localedir mandir runstatedir
12091220do
12101221 eval ac_val=\$$ac_var
12111222 # Remove trailing slashes.
···13181329 # Omit some internal or obsolete options to make the list less imposing.
13191330 # This message is too long to be a string in the A/UX 3.1 sh.
13201331 cat <<_ACEOF
13211321-\`configure' configures xmodmap 1.0.10 to adapt to many kinds of systems.
13321332+\`configure' configures xmodmap 1.0.11 to adapt to many kinds of systems.
1322133313231334Usage: $0 [OPTION]... [VAR=VALUE]...
13241335···13581369 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
13591370 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
13601371 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
13721372+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
13611373 --libdir=DIR object code libraries [EPREFIX/lib]
13621374 --includedir=DIR C header files [PREFIX/include]
13631375 --oldincludedir=DIR C header files for non-gcc [/usr/include]
···1388140013891401if test -n "$ac_init_help"; then
13901402 case $ac_init_help in
13911391- short | recursive ) echo "Configuration of xmodmap 1.0.10:";;
14031403+ short | recursive ) echo "Configuration of xmodmap 1.0.11:";;
13921404 esac
13931405 cat <<\_ACEOF
13941406···15051517test -n "$ac_init_help" && exit $ac_status
15061518if $ac_init_version; then
15071519 cat <<\_ACEOF
15081508-xmodmap configure 1.0.10
15201520+xmodmap configure 1.0.11
15091521generated by GNU Autoconf 2.69
1510152215111523Copyright (C) 2012 Free Software Foundation, Inc.
···19201932This file contains any messages produced by compilers while
19211933running configure, to aid debugging if configure makes a mistake.
1922193419231923-It was created by xmodmap $as_me 1.0.10, which was
19351935+It was created by xmodmap $as_me 1.0.11, which was
19241936generated by GNU Autoconf 2.69. Invocation command line was
1925193719261938 $ $0 $@
···4061407340624074# Define the identity of the package.
40634075 PACKAGE='xmodmap'
40644064- VERSION='1.0.10'
40764076+ VERSION='1.0.11'
406540774066407840674079cat >>confdefs.h <<_ACEOF
···1064910661# Checks for pkg-config packages
10650106621065110663pkg_failed=no
1065210652-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XMODMAP" >&5
1065310653-$as_echo_n "checking for XMODMAP... " >&6; }
1066410664+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x11 xproto >= 7.0.25" >&5
1066510665+$as_echo_n "checking for x11 xproto >= 7.0.25... " >&6; }
10654106661065510667if test -n "$XMODMAP_CFLAGS"; then
1065610668 pkg_cv_XMODMAP_CFLAGS="$XMODMAP_CFLAGS"
···106901070210691107031069210704if test $pkg_failed = yes; then
1069310693- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1070510705+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1069410706$as_echo "no" >&6; }
10695107071069610708if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
···1071710729and XMODMAP_LIBS to avoid the need to call pkg-config.
1071810730See the pkg-config man page for more details." "$LINENO" 5
1071910731elif test $pkg_failed = untried; then
1072010720- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1073210732+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1072110733$as_echo "no" >&6; }
1072210734 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
1072310735$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
···1138111393# report actual input values of CONFIG_FILES etc. instead of their
1138211394# values after options handling.
1138311395ac_log="
1138411384-This file was extended by xmodmap $as_me 1.0.10, which was
1139611396+This file was extended by xmodmap $as_me 1.0.11, which was
1138511397generated by GNU Autoconf 2.69. Invocation command line was
11386113981138711399 CONFIG_FILES = $CONFIG_FILES
···1144711459cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1144811460ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1144911461ac_cs_version="\\
1145011450-xmodmap config.status 1.0.10
1146211462+xmodmap config.status 1.0.11
1145111463configured by $0, generated by GNU Autoconf 2.69,
1145211464 with options \\"\$ac_cs_config\\"
1145311465
+2-2
app/xmodmap/configure.ac
···2424# Initialize Autoconf
2525AC_PREREQ([2.60])
2626AC_INIT([xmodmap],
2727- [1.0.10],
2727+ [1.0.11],
2828 [https://gitlab.freedesktop.org/xorg/app/xmodmap/issues],
2929 [xmodmap])
3030AC_CONFIG_SRCDIR([Makefile.am])
···3333AC_USE_SYSTEM_EXTENSIONS
34343535# Initialize Automake
3636-AM_INIT_AUTOMAKE([foreign dist-bzip2])
3636+AM_INIT_AUTOMAKE([foreign dist-xz])
37373838# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
3939m4_ifndef([XORG_MACROS_VERSION],
+17-10
app/xmodmap/exec.c
···208208 return (0);
209209}
210210211211+static int
212212+GetKeysymsPerKeycode(void)
213213+{
214214+ int min_keycode, max_keycode, keysyms_per_keycode = 0;
215215+ KeySym *m;
216216+217217+ XDisplayKeycodes(dpy, &min_keycode, &max_keycode);
218218+ m = XGetKeyboardMapping(dpy, min_keycode, (max_keycode - min_keycode + 1),
219219+ &keysyms_per_keycode);
220220+ XFree(m);
221221+ return keysyms_per_keycode;
222222+}
211223212224/*
213225 * print the contents of the map
···215227void
216228PrintModifierMapping(XModifierKeymap *map, FILE *fp)
217229{
218218- int i, k = 0;
219219- int min_keycode, max_keycode, keysyms_per_keycode = 0;
220220-221221- XDisplayKeycodes (dpy, &min_keycode, &max_keycode);
222222- XGetKeyboardMapping (dpy, min_keycode, (max_keycode - min_keycode + 1),
223223- &keysyms_per_keycode);
230230+ int k = 0;
231231+ int keysyms_per_keycode = GetKeysymsPerKeycode();
224232225233 fprintf (fp,
226234 "%s: up to %d keys per modifier, (keycodes in parentheses):\n\n",
227235 ProgramName, map->max_keypermod);
228228- for (i = 0; i < 8; i++) {
229229- int j;
230230-236236+ for (int i = 0; i < 8; i++) {
231237 fprintf(fp, "%-10s", modifier_table[i].name);
232232- for (j = 0; j < map->max_keypermod; j++) {
238238+239239+ for (int j = 0; j < map->max_keypermod; j++) {
233240 if (map->modifiermap[k]) {
234241 KeySym ks;
235242 int index = 0;
+40-7
app/xmodmap/handle.c
···3737#include "xmodmap.h"
3838#include "wq.h"
3939#include <stdlib.h>
4040+#include <stdint.h>
40414142#ifdef HAVE_STRNCASECMP
4243#include <strings.h>
···5960 * common utility routines
6061 */
61626363+/*
6464+ * This is a combination of reallocf() and reallocarray().
6565+ * If the realloc fails, it frees the old pointer so it doesn't leak.
6666+ */
6767+static void *
6868+reallocfarray(void *old, size_t num, size_t size)
6969+{
7070+ static void *new;
7171+7272+ if (size > 0 && num > (SIZE_MAX / size)) /* overflow would happen */
7373+ new = NULL;
7474+ else
7575+ new = realloc(old, num * size);
7676+7777+ if (new == NULL)
7878+ free(old);
7979+8080+ return new;
8181+}
8282+6283static KeyCode *
6384KeysymToKeycodes(Display *dpy, KeySym keysym, int *pnum_kcs)
6485{
···7293 if (!kcs)
7394 kcs = malloc(sizeof(KeyCode));
7495 else
7575- kcs = realloc(kcs, sizeof(KeyCode) * (*pnum_kcs + 1));
9696+ kcs = reallocfarray(kcs, (*pnum_kcs + 1), sizeof(KeyCode));
9797+ if (!kcs) {
9898+ fprintf(stderr, "attempt to allocate %ld byte keycode set",
9999+ (long) ((*pnum_kcs + 1) * sizeof (KeyCode)));
100100+ return NULL;
101101+ }
76102 kcs[*pnum_kcs] = i;
77103 *pnum_kcs += 1;
78104 break;
···690716 }
691717 if (nc + num_kcs > tot) {
692718 tot = nc + num_kcs;
693693- kclist = realloc(kclist, tot * sizeof(KeyCode));
719719+ kclist = reallocfarray(kclist, tot, sizeof(KeyCode));
694720 if (!kclist) {
695721 badmsg ("attempt to allocate %ld byte keycode list",
696722 (long) (tot * sizeof (KeyCode)));
···708734 if (!uop) {
709735 badmsg ("attempt to allocate %ld byte removemodifier opcode",
710736 (long) sizeof (struct op_removemodifier));
737737+ free(kclist);
711738 return;
712739 }
713740 oprm = &uop->removemodifier;
···889916 }
890917891918 if (i > 0 && i != nbuttons) {
892892- fprintf (stderr, "Warning: Only changing the first %d of %d buttons.\n",
893893- i, nbuttons);
919919+ if (i < nbuttons) {
920920+ fprintf (stderr,
921921+ "Warning: Only changing the first %d of %d buttons.\n",
922922+ i, nbuttons);
923923+ }
924924+ else { /* i > nbuttons */
925925+ fprintf (stderr,
926926+ "Warning: Not changing %d extra buttons beyond %d.\n",
927927+ i - nbuttons, nbuttons);
928928+ }
894929 i = nbuttons;
895930 }
896931···97410099751010 /* grow the list bigger if necessary */
9761011 if (havesofar >= maxcanhave) {
977977- KeySym *origkeysymlist = keysymlist;
9781012 maxcanhave *= 2;
979979- keysymlist = realloc (keysymlist, maxcanhave * sizeof (KeySym));
10131013+ keysymlist = reallocfarray(keysymlist, maxcanhave, sizeof(KeySym));
9801014 if (!keysymlist) {
9811015 badmsg ("attempt to grow keysym list to %ld bytes",
9821016 (long) (maxcanhave * sizeof (KeySym)));
983983- free(origkeysymlist);
9841017 return (-1);
9851018 }
9861019 }