Commit graph

1793 commits

Author SHA1 Message Date
Alan Coopersmith
e003f52661 man pages: Use .BR markup for references to other man pages
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/286>
2025-07-13 10:57:31 -07:00
Alan Coopersmith
d71dbf816b XSetErrorHandler.man: .BR expects at least 2 arguments, got 1
Fix warning from `groff -rCHECKSTYLE=10`

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/286>
2025-07-13 10:16:33 -07:00
Alan Coopersmith
0bddfd82d0 Compose.man: \\ should be \e in troff markup
Fixes warnings from `mandoc -T lint`:
mandoc: Compose.5:121:27: WARNING: undefined escape, printing literally: \\
mandoc: Compose.5:122:10: WARNING: undefined escape, printing literally: \\
mandoc: Compose.5:129:29: WARNING: undefined escape, printing literally: \\

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/286>
2025-07-13 10:09:14 -07:00
Alan Coopersmith
eb400f6fda man pages: remove extraneous paragraph macros
Fixes warnings from `mandoc -T lint`:

mandoc: XChangeKeyboardControl.3:156:2: WARNING: skipping paragraph macro: PP empty
mandoc: XcmsAllocColor.3:147:2: WARNING: skipping paragraph macro: PP empty
mandoc: XcmsStoreColor.3:183:2: WARNING: skipping paragraph macro: PP empty
mandoc: XConfigureWindow.3:236:2: WARNING: skipping paragraph macro: PP empty
mandoc: XCreateWindow.3:221:2: WARNING: skipping paragraph macro: PP empty
mandoc: XGetVisualInfo.3:114:2: WARNING: skipping paragraph macro: PP empty
mandoc: XOpenIM.3:73:2: WARNING: skipping paragraph macro: PP empty
mandoc: XQueryExtension.3:44:2: WARNING: skipping paragraph macro: PP after SH

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/286>
2025-07-13 10:04:44 -07:00
Alan Coopersmith
8848085323 man pages: remove whitespace at end of lines in xkb man pages
Clears 6571 complaints from `mandoc -T lint` of the form:
mandoc: man/xkb/XkbActionCtrls.3:107:4: STYLE: whitespace at end of input line

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/286>
2025-07-13 09:47:54 -07:00
Alan Coopersmith
8a32fad341 gitlab CI: ensure docs can be generated too
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/285>
2025-06-28 15:01:50 -07:00
Weng Xuetian
7f8305c779 imDefIc: Clear fabricated state on unfocus.
When unsetting focus, the event filter is removed. This means a pending
fabricated event may not yet be sent to filter.

All the fabricated event state should be cleared and the pending sync
reply sent back as if the state is unfabricated.

Fix #235

Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/283>
2025-05-24 13:46:13 -07:00
Alan Coopersmith
59917d28a3
libX11 1.8.12
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2025-03-08 15:23:04 -08:00
Olivier Fourdan
5f8077b257 xkb: Fix buffer overflow in XkbChangeTypesOfKey()
If XkbChangeTypesOfKey() is called with nGroups == 0, it will resize the
key syms to 0 but leave the key actions unchanged.

If later, the same function is called with a non-zero value for nGroups,
this will cause a buffer overflow because the key actions are of the wrong
size.

To avoid the issue, make sure to resize both the key syms and key actions
when nGroups is 0.

(cherry picked from xorg/xserver@0e4ed94952)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/279>
2025-02-26 17:26:10 -08:00
Alan Coopersmith
865fd56aeb xkb: always set *mask_rtrn in XkbVirtualModsToReal
Resolves warning from Oracle Parfait static analyser:

Error: Uninitialised memory
   Uninitialised memory variable [uninitialised-mem-var] (CWE 457):
      Possible access to uninitialised memory referenced by variable 'mask'
        at line 721 of xkb/XKBMisc.c in function 'XkbUpdateKeyTypeVirtualMods'.
        Path in callee avoiding write at line 720
          mask allocated at line 718

(cherry picked from xorg/xserver@a6574033f4)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/279>
2025-02-26 17:26:02 -08:00
Alan Coopersmith
88d1a84ca3 XkbChangeTypesOfKey: verify newTypesIn is not null before using it
Based on xorg/xserver@97c9e6a713

Fixes: 8ba0ca32 ("Janitor: ansification, make distcheck, compiler warnings.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/279>
2025-02-26 17:26:00 -08:00
Siddhesh Poyarekar
48a1335cab xkb: Allocate size_syms correctly when width of a type increases
The current code seems to skip syms with width less than
type->num_levels when calculating the total size for the new
size_syms. This leads to less space being allocated than necessary
during the next phase, which is to copy over the syms to the new
location. This results in an overflow leading to a crash.

(cherry picked from xorg/xserver@42ae2e8199)

Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/279>
2025-02-26 17:25:52 -08:00
Daniel Stone
158be3ebd7 XKB: Fix size_syms calculation bug
Apparently it needed to be nSyms*15/10, not *12/10; make it match the
other allocation code.

(cherry picked from xorg/xserver@f292de2ef1)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/279>
2025-02-26 17:25:46 -08:00
Alan Coopersmith
d6e1ca046a XkbFreeKeyboard: set xkb->geom to NULL after freeing it
Because XkbFreeGeometry takes a pointer to the geometry structure,
and not the overall xkb structure like the other XkbFree*() calls,
the caller is responsible for clearing the xkb->geom pointer to
ensure it is not used after free.

Based on xorg/xserver@629798c73a

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/279>
2025-02-26 17:25:46 -08:00
Alan Coopersmith
4a3ca6eece x11.pc: Add URL field
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/280>
2025-02-23 15:19:54 -08:00
Alan Coopersmith
23f0352eca
libX11 1.8.11
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2025-02-02 13:57:43 -08:00
Alan Coopersmith
4665733565 configure: drop pthread-stubs dependency on Dragonfly, FreeBSD, & NetBSD
syncs with changes to libxcb 1.16 & 1.16.1

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/277>
2025-01-11 10:31:08 -08:00
Aaron Muir Hamilton
ba15d51bfe ximcp/imRm.c: allow XNArea with OnTheSpot
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/270>
2025-01-10 10:45:00 -05:00
Alan Coopersmith
61175323a8 cmsColNm: remove obsolete comment about FirstCmp being public
It was made a static function in May 14, 1991 by rws in
commit "make FirstCmp static" for X11R5

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/276>
2024-12-30 10:29:37 -08:00
Pierre Le Marre
7c75a06645 Fix misuse of UCSConvertCase in XConvertCase
There are two issues with the use of `UCSConvertCase` in `XConvertCase`:

- Some Latin-1 keysyms do not map within Latin-1, e.g. `ssharp`.
  Only Latin-1 keysyms have the same value as the Unicode code point of
  their corresponding character. So `UCSConvertCase` does not work for
  some Latin-1 keysyms as it returns Unicode code points outside Latin-1
  that do not match their corresponding keysyms values.
- Some Unicode keysyms should map to Latin-1 keysyms (<0x100). But the
  Unicode keysym mask 0x01000000 is applied blindly to the result of
  `UCSConvertCase`, resulting in invalid Unicode keysyms (0x010000nn)
  while they should be Latin-1 keysyms.

Example with ß/ẞ:

```c
KeySym lower, upper;

XConvertCase(XK_ssharp, &lower, &upper);
// Expected: lower == XK_ssharp, upper == U1E9E
// Got:      lower == XK_ssharp, upper == 0x1E9E

XConvertCase(U1E9E, &lower, &upper);
// Expected: lower == XK_ssharp, upper == U1E9E
// Got:      lower == 0x10000df, upper == U1E9E
```

Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/274>
2024-12-14 07:26:34 +01:00
Alan Coopersmith
5a7d94e07f xkb: avoid undefined behavior due to left shift overflow
Closes: #225
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/273>
2024-11-16 21:11:07 +00:00
Alan Coopersmith
1ef3c6f010 XIM_SET_PAD: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 8 warnings from clang of the form:

imDefIc.c:366:29: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
        XIM_SET_PAD(&buf_s[2], len);            /* pad */
                                   ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 16:04:08 -08:00
Alan Coopersmith
22ded6890e Xrm.c: remove unneccessary ; after {}
Clears 2 clang warnings:

Xrm.c:1186:51: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
            while (is_space(bits = next_char(c, str))) {};
                                                         ^
Xrm.c:1191:48: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                while (is_space(bits = next_char(c, str))) {};
                                                             ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 16:04:03 -08:00
Alan Coopersmith
b7f59114ab DL_APPEND/DL_DELETE: remove trailing semicolon from definitions
Clears 2 clang warnings:

XlibInt.c:672:26: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
    DL_APPEND(*head, add);
                         ^
XlibInt.c:694:36: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
            DL_DELETE(*head, event);
                                   ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 15:39:49 -08:00
Alan Coopersmith
da431b8f7f xcb_io.c: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 10 warnings from clang of the form:

xcb_io.c:177:56: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                                         xcb_xlib_unknown_req_in_deq);
                                                                     ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 15:39:43 -08:00
Alan Coopersmith
a53c45d69e CI_GET_*_INFO_*: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 24 warnings from clang of the form:

TextExt16.c:63:34: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
        CI_GET_DEFAULT_INFO_1D (fs, def);
                                        ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 15:23:52 -08:00
Alan Coopersmith
6891228821 RETURN: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 5 warnings from clang of the form:

RdBitF.c:141:32: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
            RETURN (BitmapFileInvalid);
                                      ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 13:11:12 -08:00
Alan Coopersmith
38c642c8eb poly.h: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 3 warnings from clang of the form:

PolyReg.c:224:67: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
            BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres);
                                                                  ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 13:08:31 -08:00
Alan Coopersmith
906bf4a86d PutCommandResource: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 4 warnings from clang of the form:

ParseCmd.c:158:43: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                    PutCommandResource(options[i].value);
                                                        ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 12:37:53 -08:00
Alan Coopersmith
c0768ab687 GetFunc: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 4 warnings from clang of the form:

CrGlCur.c:140:64: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
    GetFunc (TryShapeCursorFunc, "XcursorTryShapeCursor", func);
                                                               ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 12:35:44 -08:00
Alan Coopersmith
4935050168 _XCreateMutex/_XFreeMutex: remove trailing semicolon from definitions
Makes them match the style of the other macros here and clears
up 5 clang warnings of the form:

Context.c:194:27: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
        _XCreateMutex(&db->linfo);
                                 ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 12:33:01 -08:00
Alan Coopersmith
41c4aa408c OneDataCard32: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 13 warnings from clang of the form:

Backgnd.c:44:72: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
    OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixel);
                                                                       ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 11:52:19 -08:00
Alan Coopersmith
68e6caad8f _XkbCheckPendingRefresh: add do ... while (0) to avoid -Wextra-semi-stmt
Clears 6 warnings from clang of the form:

XKBBind.c:74:48: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
    _XkbCheckPendingRefresh(dpy, dpy->xkb_info);
                                               ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 11:48:41 -08:00
Alan Coopersmith
563ddd4ff5 BufAlloc: add do { ... } while (0) to avoid -Wextra-semi-stmt warnings
Clears 46 warnings from clang of the form:

XKB.c:207:69: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
        BufAlloc(char *, out, (((size * 2) + (unsigned) 3) / 4) * 4);
                                                                    ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 11:46:43 -08:00
Alan Coopersmith
5e22c4b3d5 set_toupper: add do { ... } while (0) to avoid -Wextra-semi-stmt warnings
Clears 4 warnings from clang of the form:

lcUtil.c:53:18: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
        set_toupper(ch1);
                        ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 11:06:28 -08:00
Alan Coopersmith
4cb567d9a0 Data: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 38 warnings from clang of the form:

cmsLkCol.c:155:35: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
    Data (dpy, colorname, (long)n);
                                  ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 10:58:21 -08:00
Alan Coopersmith
9ab8f6a5f7 DeqAsyncHandler: add do ... while (0) to avoid -Wextra-semi-stmt warnings
Clears 12 warnings from clang of the form:

cmsCmap.c:194:34: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
            DeqAsyncHandler(dpy, &async);
                                        ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/272>
2024-11-10 10:25:56 -08:00
Julien Cristau
8703ecf105 ximcp: hide internal functions
commit 13e9ac4d45 "ximcp: Unmark to fabricate key events with XKeyEvent
serial" added new _XimFabricateSerial / _XimUnfabricateSerial /
_XimIsFabricatedSerial functions; they don't need to be exported by
libX11.

Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/271>
2024-11-04 17:24:11 +00:00
Alan Coopersmith
41bc1a9dbe ximcp: don't leak window if XGetAtomName() fails
Found by Oracle Parfait 13.3 static analyzer:
   X Resource Leak [X-resource-leak]:
      Leaked X Resource window
        at line 306 of imDefIm.c in function '_XimPreConnectionIM'.
          window initialized at line 300 with XCreateSimpleWindow

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/269>
2024-10-26 11:02:42 -07:00
Alan Coopersmith
df1f1a47f9 _XGetRequest: Set data field to 0 when initializing new requests
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/268>
2024-10-12 10:00:04 -07:00
Alan Coopersmith
f2ebbce6d0 _XimStrConversionCallback: use size_t to calculate size to malloc
Avoids build failures with gcc 14.2 when MALLOC_0_RETURNS_NULL is defined:

imCallbk.c:346:9: error: ‘memcpy’ offset 10 is out of the bounds [0, 1]
 [-Werror=array-bounds=]
  346 |         memcpy(&buf[p],&cbrec.text->string.mbs,length_in_bytes);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/267>
2024-09-29 10:24:23 -07:00
Alan Coopersmith
75c5bdee81 _XimEncodingNegotiation: swap order of arguments to calloc
Avoids build failures with gcc 14.2 when MALLOC_0_RETURNS_NULL is defined:

imDefIm.c: In function ‘_XimEncodingNegotiation’:
imDefIm.c:1739:15: error: ‘memcpy’ offset 8 is out of the bounds [0, 1]
 [-Werror=array-bounds=]
 1739 |         (void)memcpy((char *)&buf_s[2], name_ptr, name_len);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/267>
2024-09-29 10:04:40 -07:00
Alan Coopersmith
1f01aafa6d _XlcDefaultMapModifiers: remove conversions between size_t & int
Avoids build failures with gcc 14.2 when MALLOC_0_RETURNS_NULL is defined:

lcWrap.c: In function ‘_XlcDefaultMapModifiers’:
lcWrap.c:149:9: warning: ‘strcpy’ writing between 4294967296 and
 9223372036854775806 bytes into a region of size 1 [-Wstringop-overflow=]
  149 |         strcpy(mods, prog_mods);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
../../include/X11/Xlibint.h:457:24: note: destination object of size 1
 allocated by ‘malloc’
  457 | # define Xmalloc(size) malloc((size_t)((size) == 0 ? 1 : (size)))
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lcWrap.c:147:12: note: in expansion of macro ‘Xmalloc’
  147 |     mods = Xmalloc(i);
      |            ^~~~~~~
lcWrap.c:149:9: error: ‘__builtin_memcpy’ forming offset [1, 4294967295]
 is out of the bounds [0, 1] [-Werror=array-bounds=]
  149 |         strcpy(mods, prog_mods);
      |         ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/267>
2024-09-29 10:04:04 -07:00
Alan Coopersmith
86e71472bc SetFontPath: if ndirs is 0, skip work to make a list of directories
Clears warning from gcc 14.1:

SetFPath.c: In function ‘XSetFontPath’:
../include/X11/Xlibint.h:463:24: warning: argument 1 value is zero
 [-Walloc-zero]
  463 | # define Xmalloc(size) malloc((size_t)(size))
      |                        ^~~~~~~~~~~~~~~~~~~~~~
SetFPath.c:61:18: note: in expansion of macro ‘Xmalloc’
   61 |         if ((p = Xmalloc (nbytes))) {
      |                  ^~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/266>
2024-08-31 10:49:16 -07:00
Olivier Fourdan
19b2f5c2d0 Fix indentation
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/264>
2024-08-09 11:15:44 +02:00
Olivier Fourdan
f3d6ebac35 Close xcb connection after freeing display structure
Commit 1472048b7 to fix a colormap threading issue added a display
lock/unlock and a call to SyncHandle() to _XcmsFreeClientCmaps().

When running synchronized, that means calling XSync().

_XcmsFreeClientCmaps() is called from _XFreeDisplayStructure() via
XCloseDisplay() after the xcb connection is closed.

So when running synchronized, we may end up calling XSync() after the
xcb connection to the display is closed, which will generate a spurious
XIO error:

  | #0 in _XDefaultIOError () at /lib64/libX11.so.6
  | #1 in _XIOError () at /lib64/libX11.so.6
  | #2 in _XReply () at /lib64/libX11.so.6
  | #3 in XSync () at /lib64/libX11.so.6
  | #4 in _XSyncFunction () at /lib64/libX11.so.6
  | 8#5 in _XFreeDisplayStructure () at /lib64/libX11.so.6
  | 8#6 in XCloseDisplay () at /lib64/libX11.so.6

To avoid that issue, closed the xcb connection to the display last.

v2: And same in OutOfMemory() as well (José Expósito)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/264>
2024-08-09 11:15:37 +02:00
Alan Coopersmith
ed9fb5535e
libX11 1.8.10
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-07-28 10:37:55 -07:00
Kelly Roadkill
92014b3963 Revert "nls: add compose seq's for symbols absent from Cyrillic layouts to ru_RU"
Testing by multilingual typists revealed that the
proposed sequences are too complex for everyday
use. It seems that the inherent problems with
JCUKEN can only be fixed with better kbd layouts.

This reverts commit 174df0b8b6.

Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/261>
2024-07-23 08:12:01 +05:00
Kelly Roadkill
be137dffa6 nls: add compose sequences for hryvnia currency
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/259>
2024-07-20 16:33:10 +00:00
Alan Coopersmith
39d57cbeda xlibi18n/lcFile.c: avoid use of possibly-NULL pointer with strcpy
Fixes gcc warnings:
lcFile.c: In function ‘_XlcLocaleLibDirName’:
lcFile.c:708:5: warning: use of possibly-NULL ‘last_dir_name’ where
 non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
  708 |     strcpy (last_dir_name, dir_name);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/258>
2024-07-13 10:14:02 -07:00