xkbcomp: fix crashes in the parser when geometry tokens appear
authorRan Benita <ran234@gmail.com>
Sat, 10 Mar 2018 21:32:12 +0000 (23:32 +0200)
committerRan Benita <ran234@gmail.com>
Mon, 30 Jul 2018 07:35:10 +0000 (10:35 +0300)
commite3cacae7b1bfda0d839c280494f23284a1187adf
treed3a1f16be664564d8329e6dd26dc6f0d908e789f
parent1f9d1248c07cda8aaff762429c0dce146de8632a
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>
src/xkbcomp/ast-build.c
src/xkbcomp/ast-build.h
src/xkbcomp/ast.h
src/xkbcomp/parser.y