libxkbfile: Changes to 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 28 18:52:23 UTC 2025


 src/maprules.c |   12 +++++-------
 src/xkbmisc.c  |   34 ++++++++++++++++++++++------------
 src/xkbtext.c  |   38 ++++++++++++++++++--------------------
 src/xkmread.c  |   12 +++++++++---
 4 files changed, 54 insertions(+), 42 deletions(-)

New commits:
commit f6592c6f272587456f69aef6e1db6a1aef5731ca
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Wed Nov 27 14:41:45 2024 +0100

    xkb: Fix buffer overflow in XkbVModMaskText()
    
    The code in XkbVModMaskText() allocates a fixed sized buffer on the
    stack and copies the virtual mod name.
    
    There's actually two issues in the code that can lead to a buffer
    overflow.
    
    First, the bound check mixes pointers and integers using misplaced
    parenthesis, defeating the bound check.
    
    But even though, if the check fails, the data is still copied, so the
    stack overflow will occur regardless.
    
    Change the logic to skip the copy entirely if the bound check fails.
    
    (cherry picked from xorg/xserver at 11fcda8753e994e15eb915d28cf487660ec8e722)
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 730c9df040546f1a98ab1b974ad2ccd1b4ad4552
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Aug 17 16:04:40 2021 -0400

    xkbtext.c: Silence a warning from gcc 11
    
    I get this:
    
        In function ‘TryCopyStr’,
            inlined from ‘CopyISOLockArgs’ at ../xkb/xkbtext.c:875:9:
        ../xkb/xkbtext.c:720:13: warning: ‘tbuf’ may be used uninitialized [-Wmaybe-uninitialized]
          720 |             strcat(to, from);
              |             ^~~~~~~~~~~~~~~~
        ../xkb/xkbtext.c: In function ‘CopyISOLockArgs’:
        <built-in>: note: by argument 1 of type ‘const char *’ to ‘__builtin_strlen’ declared here
        ../xkb/xkbtext.c:871:10: note: ‘tbuf’ declared here
          871 |     char tbuf[64];
              |          ^~~~
    
    Just initialize tbuf so it definitely works.
    
    (cherry picked from xorg/xserver at b49f0f9b323d66056aa9cd88f9ca1a124037bf32)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit e0c9b14cb27d8b729e5161945465ac89b82206b1
Author: Konstantin Kharlamov <Hi-Angel at yandex.ru>
Date:   Sun Mar 24 02:06:59 2019 +0300

    xkbtext.c: fix copy-paste error
    
    As can be seen in diff, nOut is always 0 here. The code was likely
    copy-pasted from comparisons further below.
    
    Fixes LGTM warning "Comparison is always false because nOut <= 0."
    
    (cherry picked from xorg/xserver at bad94e88cef8b692982ed0af112e7b2191ba558b)
    
    Signed-off-by: Konstantin Kharlamov <Hi-Angel at yandex.ru>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 216fe438033b877fdf0afb6432e9554b66fd1d5c
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Apr 18 15:12:14 2014 -0700

    xkmread.c: Verify reads of compiled keymap header and TOC
    
    Check the return values from fread to make sure the elements are
    actually getting read from the file.
    
    (cherry picked from xorg/xserver at c7011249d2abe6cc7af82ee4b79d8f6873444707)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 8e23a1a7f1dc9646b48f09e63f05db6d12db00fd
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 3 20:44:43 2011 -0700

    xkbtext.c: Reduce unnecessary string copying
    
    Instead of using sprintf to copy a static string to a local buffer,
    just to pass it to TryCopyStr, pass the static string to TryCopyStr
    directly, as is already done in other parts of this code.
    
    (cherry picked from xorg/xserver at 3d0ece5e8467d823afb227b7a7f8b12b906b6ba9)
    
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 7a51a981087a8b67ba0e085c9037c2d778401c63
Author: Cyril Brulebois <kibi at debian.org>
Date:   Fri Jun 3 18:09:48 2011 +0200

    xkbmisc.c: Fix case checks for Latin 8.
    
    Spotted by -Wlogical-op:
    |   CC     xkbfmisc.lo
    | xkbfmisc.c: In function '_XkbKSCheckCase':
    | xkbfmisc.c:104:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
    | xkbfmisc.c:118:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
    
    A quick look at the keysymdef.h file (from xproto) suggests the
    implementor chose to use interval checks to determine the case, but
    since lines weren't sorted by codepoints, checks were quite wrong.
    
    Implement _XkbKSUpper/_XkbKSLower checks based on a grep for
    CAPITAL/SMALL (respectively) on the Latin 8 part of the said file.
    
    (cherry picked from xorg/xserver at 408ed1576dbcf93f4bd27bd3b66917b1bba2226b)
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Cyril Brulebois <kibi at debian.org>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 37665f6681fa782e7ac0b2ce3fa47ee304f1aa51
Author: Cyril Brulebois <kibi at debian.org>
Date:   Sun Jun 5 03:21:18 2011 +0200

    xkbmisc.c: Fix case checks for Latin 4.
    
    That one was missing _XkbKSLower:
      XK_kra: U+0138 LATIN SMALL LETTER KRA
    
    (cherry picked from xorg/xserver at ab0df72cd33f011cc48736cfbfce9bbe9c359a80)
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Cyril Brulebois <kibi at debian.org>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit c2833fcb9a9eafbbf99f324a740f8fb0b4499350
Author: Cyril Brulebois <kibi at debian.org>
Date:   Sun Jun 5 03:12:44 2011 +0200

    xkbmisc.c: Fix case checks for Latin 2.
    
    Those ones were getting _XkbKSLower for no reasons:
      XK_ogonek: U+02DB OGONEK
      XK_doubleacute: U+02DD DOUBLE ACUTE ACCENT
    
    (cherry picked from xorg/xserver at 9eb6e34c2dd09af714400ce6a1063477d7a64776)
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Cyril Brulebois <kibi at debian.org>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 03aecd48b38d9b611ca0ec6189bac9a7c8e35f4d
Author: Cyril Brulebois <kibi at debian.org>
Date:   Sun Jun 5 03:03:47 2011 +0200

    xkbmisc.c: Fix case checks for Latin 1.
    
    That one was missing _XkbKSLower:
      XK_ssharp: U+00DF LATIN SMALL LETTER SHARP S
    
    That one was getting _XkbKSLower for no reasons:
      XK_division: U+00F7 DIVISION SIGN
    
    For reference, XK_multiply was already excluded from the _XkbKSUpper
    check, it's no big surprise XK_division has to be excluded from the
    _XkbKSLower check.
    
    (cherry picked from xorg/xserver at 2b88189863579eb377bca617465bb76b05fbdebd)
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Cyril Brulebois <kibi at debian.org>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 219c4b034528659c6b6fd6acade8636e7c840ac0
Author: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
Date:   Thu Jul 22 12:48:55 2010 +0300

    xkmread.c: Fix NULL pointer dereference
    
    xkb->names is dereferenced in else path too.
    
    (cherry picked from xorg/xserver at 2475ef60977f6813dec74ef0837a5915b8a48bbc)
    
    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>

commit 4fb0856ec26acc35297931bc49c64d28d4f7abfa
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Feb 22 12:58:51 2025 -0800

    maprules.c: Use snprintf to measure string lengths instead of strlen math
    
    Based on xorg/xserver at a4a2e814d5d0e6152307a301eda1d6fc1c555aaa
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>



More information about the xorg-commit mailing list