symbols: fix index-out-of-bounds in FindAutomaticType
authorRan Benita <ran234@gmail.com>
Mon, 24 Sep 2012 08:16:09 +0000 (10:16 +0200)
committerRan Benita <ran234@gmail.com>
Mon, 24 Sep 2012 08:19:02 +0000 (10:19 +0200)
If we enter this branch, we have 3 <= width <= 4, so if the width is 3
than syms[3] is out of bounds.

Happily inherited from xkbcomp.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/symbols.c

index 09d577e..616e850 100644 (file)
@@ -1452,7 +1452,8 @@ FindAutomaticType(struct xkb_context *ctx, xkb_level_index_t width,
     else if (width <= 4) {
         if (syms && xkb_keysym_is_lower(syms[0]) &&
             xkb_keysym_is_upper(syms[1]))
-            if (xkb_keysym_is_lower(syms[2]) && xkb_keysym_is_upper(syms[3]))
+            if (width == 4 && xkb_keysym_is_lower(syms[2]) &&
+                xkb_keysym_is_upper(syms[3]))
                 *typeNameRtrn =
                     xkb_atom_intern(ctx, "FOUR_LEVEL_ALPHABETIC");
             else