Commit Graph

1827 Commits (40bea8e9fa715c099173929149c134525383d3a2)

Author SHA1 Message Date
maxice8 9badb4e4a2 meson.build: use program from build machine not host or target.
We can't always execute binaries from the host or target machine,
as is the case in cross compilation.

closes #89
2019-02-23 09:04:36 +00:00
Ran Benita d40b368b2f Bump version to 0.8.4
Signed-off-by: Ran Benita <ran234@gmail.com>
2019-02-22 22:26:49 +02:00
Ran Benita 2d9e1751d0 Update NEWS
Signed-off-by: Ran Benita <ran234@gmail.com>
2019-02-22 22:26:11 +02:00
Ran Benita df28d5e8e3 build: fix meson build from tarball generated by autotools
These files are used by the meson build only. Previously, trying to
build with meson using the tarball generated by distcheck would fail.

Fixes https://github.com/xkbcommon/libxkbcommon/issues/87.

Reported-by: manesm52
Signed-off-by: Ran Benita <ran234@gmail.com>
2019-02-22 15:46:44 +02:00
Peter Hutterer 3f5095339f meson.build: link the sources directly into libxkbcommon-x11
Similar to 75ce741ab9, just for the -x11
sublibrary.

This works around meson bug 3937, 'link_whole' arguments don't get added into
the final static library and we end up with a virtually empty 8-byte
libxkbcommon-x11.a file, see https://github.com/mesonbuild/meson/issues/3937

The internal lib is still built for the one test case that requires it.

Fixes #86

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 11:35:34 +02:00
Ran Benita 9f93ebcf2b Bump version to 0.8.3
Signed-off-by: Ran Benita <ran234@gmail.com>
2019-02-08 12:39:01 +02:00
Ran Benita 53e7a315c3 Update NEWS
Signed-off-by: Ran Benita <ran234@gmail.com>
2019-02-08 12:38:02 +02:00
Ran Benita caddfdb0ad meson: make comment make sense now
Signed-off-by: Ran Benita <ran234@gmail.com>
2019-02-08 12:29:27 +02:00
Ran Benita 327fd9a1de
Merge pull request #85 from whot/wip/static-lib-sources
meson.build: manually link all sources into the library
2019-02-08 12:18:00 +02:00
Peter Hutterer 75ce741ab9 meson.build: manually link all sources into the library
This works around meson bug 3937, 'link_whole' arguments don't get added into
the final static library and we end up with a virtually empty 8-byte
libxkbcommon.a file, see https://github.com/mesonbuild/meson/issues/3937

Workaround is simply to add all sources to both libraries we need them in.
This obviously compiles them twice but this year's winter was cold and
bit of extra warmth will be appreciated.

Fixes #84

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-08 12:21:28 +10:00
Ran Benita 73794e1e54 docs: fix a doxygen reference warning 2019-01-28 16:29:09 +02:00
Ran Benita 828cec7b8b
Merge pull request #81 from whot/master
keysyms: fix comment for XKB_KEY_OCARON
2019-01-25 12:50:55 +02:00
Peter Hutterer e08d589f2c keysyms: fix comment for XKB_KEY_OCARON
Reported-by: Keve Müller
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-25 10:39:22 +10:00
Ran Benita bc04af63c0
Merge pull request #79 from jwrdegoede/add-2-new-keysyms
Sync Keysyms with recent xproto additions
2019-01-22 09:48:23 +02:00
Hans de Goede 9b85d96d2a Sync Keysyms with recent xproto additions
xproto recently has been extended with 2 new keysyms:
XF86XK_MonBrightnessCycle
XF86XK_RotationLockToggle

This commit is the result of running "scripts/update-keysyms" on a system
with the updated xproto installed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-01-22 08:31:43 +01:00
Ran Benita 293c704cbe
Merge pull request #69 from alanc/master
Fix off-by-one error in index check in xkb_file_type_to_string
2018-10-01 10:24:45 +03:00
Alan Coopersmith 31f1f35570 Fix off-by-one error in index check in xkb_file_type_to_string
Found by Oracle's Parfait 2.2 static analyzer:
Error: Buffer overrun
   Read outside array bounds [read-outside-array-bounds] (CWE 125):
      In array dereference of xkb_file_type_strings[type] with index type
      Array size is 56 bytes, index <= 56
        at line 734 of src/xkbcomp/ast-build.c in function 'xkb_file_type_to_string'.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-09-30 16:04:29 -07:00
Ran Benita c9a499c9c9 darray: fix unprotected macro argument
Reported-by: @msmeissn
Signed-off-by: Ran Benita <ran234@gmail.com>
2018-08-24 09:19:29 +03:00
Ran Benita 87b0765fde
Merge pull request #68 from whot/wip/xkeyboard-config-tester
xkeyboard-config combination tester
2018-08-21 09:05:09 +03:00
Peter Hutterer 878bc08559 test: allow for absolute paths to be resolved
This makes it possible to check a keymap sitting elsewhere than in the test
directory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-21 11:31:10 +10:00
Peter Hutterer 16c84cdd81 test: drop the rmlvo ability from print-compiled-keymap
This is now handled by the rmlvo-to-keymap tool

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-21 11:31:07 +10:00
Peter Hutterer d1cb8ad409 test: add a tool to test-compile all LVO combinations from xkeyboard-config
This test contains of two parts:
- a simple program to convert RMLVO commandline arguments into a keymap (and
  print that keymap if requested).
- a python script that runs through rules/evdev.xml, and tries to compile a
  keymap for sort-of every layout/variant/option combination. Sort-of, because
  we can have multiple options and it really only does one per layout(variant)
  combination.

Same thing can be done using xkbcomp, but right now it doesn't take that as
argument, it's hard-coded.

This takes quite a while, installing python-tqdm is recommended to see fancy
progress bars instead of just miles of dumps.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-21 11:30:45 +10:00
Ran Benita d7891d0913 build: turn off strict aliasing
The benchmarks don't show any effect, so turn it off to have one less
thing to worry about. The parser does a lot of casting between AST
nodes.

Signed-off-by: Ran Benita <ran234@gmail.com>
2018-08-18 15:12:57 +03:00
Ran Benita a9ace75f64 x11: fix undefined behavior when copying the coordinates of ptr movements actions
Left shift of a negative integer. For some reason the protocol
representation here got really botched (in the spec it is just a nice
and simple INT16).

Signed-off-by: Ran Benita <ran234@gmail.com>
2018-08-18 14:58:03 +03:00
Ran Benita f8134c8503 Bump version to 0.8.2
Signed-off-by: Ran Benita <ran234@gmail.com>
2018-08-05 08:55:39 +03:00
Ran Benita e3f9c1b4cf Update NEWS
Signed-off-by: Ran Benita <ran234@gmail.com>
2018-08-05 08:55:39 +03:00
Ran Benita a3e110d605
Merge pull request #67 from fooishbar/fix-more-fuzz
Fix more fuzz-testing fallout
2018-08-05 08:45:19 +03:00
Daniel Stone bb4909d2d8 Fail expression lookup on invalid atoms
If we fail atom lookup, then we should not claim that we successfully
looked up the expression.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:24:50 +01:00
Daniel Stone 5440aaa522 Fix signed vs. unsigned confusion in name sanitisation
Don't try to divide through a signed char when indexing an array, lest
ye try to index off the start of it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:17:10 +01:00
Daniel Stone 4fcbc47059 darray: Don't call memcpy() on NULL
The only time we could ever hit this was with count == 0, which seems
unnecessarily pedantic. But OK.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:15:49 +01:00
Daniel Stone ae7856db48 text: NULL-terminate SI mask names
The list should have a NULL sentry. Add one.

testcase: 'interpret KP_Delete+AnyOfOrNaneo(ll)'

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:15:48 +01:00
Daniel Stone 38e1766bc6 xkbcomp: Don't falsely promise from ExprResolveLhs
Every user of ExprReturnLhs goes on to unconditionally dereference the
field return, which can be NULL if xkb_intern_atom fails. Return false
if this is the case, so we fail safely.

testcase: splice geometry data into interp

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:14:16 +01:00
Daniel Stone 4e2ee9c3f6 xkbcomp: Don't explode on invalid virtual modifiers
testcase: 'virtualModifiers=LevelThreC'

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:14:16 +01:00
Daniel Stone 96df3106d4 xkbcomp: Don't crash on no-op modmask expressions
If we have an expression of the form 'l1' in an interp section, we
unconditionally try to dereference its args, even if it has none.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:13:35 +01:00
Daniel Stone a8ea7a1d3d parser: Don't set more maps when we don't have any
If the scanner indicates that we might have something which looks like a
map, but the parser in fact fails to create that map, we will try to
access the map regardless. Stop doing that.

testcase: 'xkb_keymap {' -> '#kb_keymap'

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-08-03 16:13:35 +01:00
Ran Benita 87046f56ef Bump version to 0.8.1
Signed-off-by: Ran Benita <ran234@gmail.com>
2018-08-03 13:55:52 +03:00
Ran Benita 1a138abf75 Update NEWS
Signed-off-by: Ran Benita <ran234@gmail.com>
2018-08-03 13:55:17 +03:00
Ran Benita 1f3666915b
Merge pull request #66 from whot/master
Coverity fixes (one real bug)
2018-08-01 12:25:18 +03:00
Peter Hutterer c81682975d action: make a note that we may not null-terminate private strings
Coverity complains that a 7-byte string may not be null-terminated when copied
into act->data (size 7). This is fine, make a note of it.

All the strings in xkeyboard-config only use 6 bytes + null terminator so this
won't be an issue. The server (the only user of these) uses an 8-byte array
and forcibly null-terminates the string, see XkbDDXPrivate().

Everything else treats it as byte-array size 7 anyway so whether it's
null-terminated doesn't matter.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-01 18:50:38 +10:00
Peter Hutterer c1e5ac16e7 xkbcomp: fix pointer value for FreeStmt
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-01 13:50:38 +10:00
Peter Hutterer badb428e63 keycodes: don't try to copy zero key aliases
Move the aliases copy to within the (num_key_aliases > 0) block.

Passing info->aliases into this fuction with invalid aliases will
cause log messages but num_key_aliases stays on 0. The key_aliases array
is never allocated and remains NULL. We then loop through the aliases, causing
a null-pointer dereference.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-01 13:50:38 +10:00
Peter Hutterer 9045b03598 text: init the target buffer to zero
There's a (theoretical?) path where we might end up strcpy() buf without ever
writing to it. This happens if the mask is nonzero but specifies a modifier
larger than the one in the xkb_mod_set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-01 13:50:38 +10:00
Ran Benita 842e4351c2 compose: fix infinite loop in parser on some inputs
The parser would enter an infinite loop if an unterminated keysym
literal occurs at EOF.

Found with the afl fuzzer.

Signed-off-by: Ran Benita <ran234@gmail.com>
2018-07-30 10:35:10 +03:00
Ran Benita 917636b1d0 xkbcomp: fix crash when parsing an xkb_geometry section
xkb_geometry sections are ignored; previously the had done so by
returning NULL for the section's XkbFile, however some sections of the
code do not expect this. Instead, create an XkbFile for it, it will
never be processes and discarded later.

Caught with the afl fuzzer.

Signed-off-by: Ran Benita <ran234@gmail.com>
2018-07-30 10:35:10 +03:00
Ran Benita e3cacae7b1 xkbcomp: fix crashes in the parser when geometry tokens appear
In the XKB format, floats and various keywords can only be used in the
xkb_geometry section. xkbcommon removed support xkb_geometry, but still
parses it for backward compatibility. As part of ignoring it, the float
AST node and various keywords were removed, and instead NULL was
returned by their parsing actions. However, the rest of the code does
not handle NULLs, and so when they appear crashes usually ensue.

To fix this, restore the float AST node and the ignored keywords. None
of the evaluating code expects them, so nice error are displayed.

Caught with the afl fuzzer.

Signed-off-by: Ran Benita <ran234@gmail.com>
2018-07-30 10:35:10 +03:00
Ran Benita 1f9d1248c0 xkbcomp: fix stack overflow when evaluating boolean negation
The expression evaluator would go into an infinite recursion when
evaluating something like this as a boolean: `!True`. Instead of
recursing to just `True` and negating, it recursed to `!True` itself
again.

Bug inherited from xkbcomp.

Caught with the afl fuzzer.

Signed-off-by: Ran Benita <ran234@gmail.com>
2018-07-30 10:35:10 +03:00
Ran Benita 2cb5c2a3f3 Add fuzzing infrastructure
Though text formats aren't exactly fuzzer's strong suit, fuzzers can
catch many surface-level bugs.

The fuzz/ directory contains target programs, testcases and dictionaries
to drive the afl fuzzer.

This commit adds a fuzzer for the XKB keymap text format and the Compose
text format. On my slow machine, using a single core, a full cycle of
the XKB fuzzer takes 5 hours. For Compose, it takes a few minutes.

Fuzzing for the other file formats (rules files mostly) will be added
later.

To do some fuzzing, run `./fuzz/fuzz.sh`.

Signed-off-by: Ran Benita <ran234@gmail.com>
2018-07-30 10:35:10 +03:00
Ran Benita a54cfe087a
Merge pull request #65 from heftig/pc-fix2
meson: Fix xkbcommon-x11.pc Requires versioning
2018-07-17 19:06:12 +03:00
Jan Alexander Steffens (heftig) 83a553a009 meson: Fix xkbcommon-x11.pc Requires versioning
Old meson expects an array with one dependency per element. Providing a
string containing multiple deps results in only the first dep getting
its whitespace properly applied. As a result, the output was:

    Requires.private: xcb >= 1.10 xcb-xkb>=1.10

And downstream projects failed to find a package named 'xcb-xkb>=1.10'.

Specifying an array of versioned deps results in correct output:

    Requires.private: xcb >= 1.10, xcb-xkb >= 1.10

Fixes #64.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
2018-07-17 17:31:55 +02:00
Jan Alexander Steffens (heftig) a3c907d389 meson: Fix xkbcommon-x11.pc Requires
The meson-generated pkgconfig file was missing Requires and
Requires.private.

[ran: adjust for older Meson versions.]

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
2018-07-17 09:30:43 +03:00