Hi,

The patch below brings the X server in xenocara in sync with X.Org
21.1.4. The security related bits of this release were commited for
the last xserver errata, but there are a few other bug fixes in this
release. In particular it should fix the crash reported on bugs@ by
Walter Alejandro Iglesias.

Apply by running:

    patch -p0 -E < /path/to/this/file

and rebuild Xenocara as per release(8).

ok ? comments ?

PS: the actual release contains more stuff for Xquartz. I'll commit
those when I get an ok, but still this code is not built or run on
OpenBSD, no need to review it nor test it.

Index: ChangeLog
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/ChangeLog,v
retrieving revision 1.41
diff -u -p -u -r1.41 ChangeLog
--- ChangeLog   20 Feb 2022 17:41:34 -0000      1.41
+++ ChangeLog   30 Aug 2022 17:15:38 -0000
@@ -1,3 +1,508 @@
+commit 6bf62381d0a1fb54226a10f9d0e6b03aff12f3aa
+Author: Povilas Kanapickas <[email protected]>
+Date:   Tue Jul 12 16:09:23 2022 +0300
+
+    xserver 21.1.4
+
+commit 06b23cccb1166fcccc2f5fe7259b3ef9e1d0f32e
+Author: Peter Hutterer <[email protected]>
+Date:   Tue Jul 5 11:11:06 2022 +1000
+
+    xkb: add request length validation for XkbSetGeometry
+    
+    No validation of the various fields on that report were done, so a
+    malicious client could send a short request that claims it had N
+    sections, or rows, or keys, and the server would process the request for
+    N sections, running out of bounds of the actual request data.
+    
+    Fix this by adding size checks to ensure our data is valid.
+    
+    ZDI-CAN 16062, CVE-2022-2319.
+    
+    This vulnerability was discovered by:
+    Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
+    
+    Signed-off-by: Peter Hutterer <[email protected]>
+    (cherry picked from commit 6907b6ea2b4ce949cb07271f5b678d5966d9df42)
+
+commit e3a530540f2f13739b0233ec51d7a3985a7ec4be
+Author: Peter Hutterer <[email protected]>
+Date:   Tue Jul 5 09:50:41 2022 +1000
+
+    xkb: swap XkbSetDeviceInfo and XkbSetDeviceInfoCheck
+    
+    XKB often uses a FooCheck and Foo function pair, the former is supposed
+    to check all values in the request and error out on BadLength,
+    BadValue, etc. The latter is then called once we're confident the values
+    are good (they may still fail on an individual device, but that's a
+    different topic).
+    
+    In the case of XkbSetDeviceInfo, those functions were incorrectly
+    named, with XkbSetDeviceInfo ending up as the checker function and
+    XkbSetDeviceInfoCheck as the setter function. As a result, the setter
+    function was called before the checker function, accessing request
+    data and modifying device state before we ensured that the data is
+    valid.
+    
+    In particular, the setter function relied on values being already
+    byte-swapped. This in turn could lead to potential OOB memory access.
+    
+    Fix this by correctly naming the functions and moving the length checks
+    over to the checker function. These were added in 87c64fc5b0 to the
+    wrong function, probably due to the incorrect naming.
+    
+    Fixes ZDI-CAN 16070, CVE-2022-2320.
+    
+    This vulnerability was discovered by:
+    Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
+    
+    Introduced in c06e27b2f6fd9f7b9f827623a48876a225264132
+    
+    Signed-off-by: Peter Hutterer <[email protected]>
+    (cherry picked from commit dd8caf39e9e15d8f302e54045dd08d8ebf1025dc)
+
+commit e75840565775dc95b848b366aeed44066a9d8a28
+Author: Peter Hutterer <[email protected]>
+Date:   Tue Jul 5 12:40:47 2022 +1000
+
+    xkb: switch to array index loops to moving pointers
+    
+    Most similar loops here use a pointer that advances with each loop
+    iteration, let's do the same here for consistency.
+    
+    No functional changes.
+    
+    Signed-off-by: Peter Hutterer <[email protected]>
+    Reviewed-by: Olivier Fourdan <[email protected]>
+    (cherry picked from commit f1070c01d616c5f21f939d5ebc533738779451ac)
+
+commit f3d9c6ff12b5a8a1a9f316b096d5573060747ff9
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Mon Jul 4 14:16:43 2022 -0700
+
+    xquartz: Add missing files to distribution tarball
+    
+    Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1346
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+
+commit 147c17fc786c268ec51dc0f0655e69f6493f7ef2
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sat Jul 2 14:15:50 2022 -0700
+
+    XQuartz: Improve type safety for X11Controller's application menu editor
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 4cfdc5af31ae8282903d0f65cff858330b9f9d1a)
+
+commit 9e2fc7e2484be7c577ee5baf3765734beef9adc2
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sat Jul 2 14:17:18 2022 -0700
+
+    xquartz: Fix a possible crash when editing the Application menu due to 
mutaing immutable arrays
+    
+    Crashing on exception: -[__NSCFArray replaceObjectAtIndex:withObject:]: 
mutating method sent to immutable object
+    
+    Application Specific Backtrace 0:
+    0   CoreFoundation                      0x00007ff80d2c5e9b 
__exceptionPreprocess + 242
+    1   libobjc.A.dylib                     0x00007ff80d027e48 
objc_exception_throw + 48
+    2   CoreFoundation                      0x00007ff80d38167b 
_CFThrowFormattedException + 194
+    3   CoreFoundation                      0x00007ff80d382a25 -[__NSCFArray 
removeObjectAtIndex:].cold.1 + 0
+    4   CoreFoundation                      0x00007ff80d2e6c0b -[__NSCFArray 
replaceObjectAtIndex:withObject:] + 119
+    5   X11.bin                             0x00000001003180f9 -[X11Controller 
tableView:setObjectValue:forTableColumn:row:] + 169
+    
+    Fixes: https://github.com/XQuartz/XQuartz/issues/267
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit dfd057996b26420309c324ec844a5ba6dd07eda3)
+
+commit 86ace20398a6c559e89213622538134b72e448b1
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Fri Jul 1 14:26:06 2022 -0700
+
+    xquartz: Use correct defines when building to support Sparkle updates
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit aa636b97c66343b25e508b9c73d8505e8c11b1d9)
+
+commit 855b96a85bc0711460a2542573a9a3959d1bfefa
+Author: Povilas Kanapickas <[email protected]>
+Date:   Sun Dec 19 16:51:39 2021 +0200
+
+    xfree86: Fix event data alignment in inputtest driver
+    
+    This fixes address sanitizer errors when running unit tests. The
+    additional copying may reduce performance by a small amount, but we
+    don't care about that because this driver is used for testing only.
+    
+    Signed-off-by: Povilas Kanapickas <[email protected]>
+    (cherry picked from commit 7d2014e7d523e10623203582b9f573303750f087)
+
+commit 9d05ee10c231edacc69b342677ae8c3cc32f97e5
+Author: Povilas Kanapickas <[email protected]>
+Date:   Sun Jan 16 10:42:15 2022 +0200
+
+    dix: Don't send touch end to clients that do async grab without touches
+    
+    GTK3 menu widget creates a selection for touch and other events and
+    after receiving touch events creates an async grab that excludes touch
+    events. Unfortunately it relies on X server not sending the touch end
+    event in order to function properly. Sending touch end event will cause
+    it to think that the initiating touch ended and when it actually ends,
+    the ButtonRelease event will make it think that the menu should be
+    closed. As a result, the menu will be open only for the duration of the
+    touch making it useless.
+    
+    This commit reverts f682e0563f736ed2c2c612ed575e05b6e3db945e.
+    
+    Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1255
+    
+    Signed-off-by: Povilas Kanapickas <[email protected]>
+    (cherry picked from commit 43e934a19f644cddedae73602e86429c9dc5074a)
+
+commit b713e717c34d539486f661c03a0f1b35b3208d21
+Author: Povilas Kanapickas <[email protected]>
+Date:   Sun Jan 23 22:18:52 2022 +0200
+
+    dix: Correctly save replayed event into GrabInfoRec
+    
+    When processing events we operate on InternalEvent pointers. They may
+    actually refer to a an instance of DeviceEvent, GestureEvent or any
+    other event that comprises the InternalEvent union. This works well in
+    practice because we always look into event type before doing anything,
+    except in the case of copying the event.
+    
+    *dst_event = *src_event would copy whole InternalEvent event and would
+    cause out of bounds read in case the pointed to event was not
+    InternalEvent but e.g. DeviceEvent.
+    
+    This regression has been introduced in
+    23a8b62d34344575f9df9d057fb74bfefa94a77b.
+    
+    Fixes https://gitlab.freedesktop.org/xorg/xserver/-/issues/1261
+    
+    Signed-off-by: Povilas Kanapickas <[email protected]>
+    (cherry picked from commit 6ef5c05728f8b18170fbc8415d7502495a08670b)
+
+commit cd3d21d8c44a35c22b7eca61a58bb5620b116102
+Author: Samuel Thibault <[email protected]>
+Date:   Wed Jan 26 00:05:55 2022 +0100
+
+    xkb: fix XkbSetMap when changing a keysym without changing a keytype
+    
+    As the comment says:
+    
+    "symsPerKey/mapWidths must be filled regardless of client-side flags"
+    
+    so we always have to call CheckKeyTypes which will notably fill mapWidths
+    and nTypes. That is needed for CheckKeySyms to work since it checks the
+    width. Without it, any request with XkbKeySymsMask but not
+    XkbKeyTypesMask will fail because of the missing width information, for
+    instance this:
+    
+      XkbDescPtr xkb;
+      if (!(xkb = XkbGetMap (dpy, XkbKeyTypesMask|XkbKeySymsMask, 
XkbUseCoreKbd))) {
+        fprintf (stderr, "ERROR getting map\n");
+        exit(1);
+      }
+      XFlush (dpy);
+      XSync (dpy, False);
+    
+      XkbMapChangesRec changes = { .changed = 0 };
+      int oneGroupType[XkbNumKbdGroups] = { XkbOneLevelIndex };
+    
+      if (XkbChangeTypesOfKey(xkb, keycode, 1, XkbGroup1Mask, oneGroupType, 
&changes)) {
+        fprintf(stderr, "ERROR changing type of key\n");
+        exit(1);
+      }
+      XkbKeySymEntry(xkb,keycode,0,0) = keysym;
+    
+      if (!XkbChangeMap(dpy,xkb,&changes)) {
+        fprintf(stderr, "ERROR changing map\n");
+        exit(1);
+      }
+    
+      XkbFreeKeyboard (xkb, 0, TRUE);
+      XFlush (dpy);
+      XSync (dpy, False);
+    
+    This had being going under the radar since about ever until commit
+    de940e06f8733d87bbb857aef85d830053442cfe ("xkb: fix key type index check
+    in _XkbSetMapChecks") fixed checking the values of kt_index, which was
+    previously erroneously ignoring errors and ignoring all other checks, just
+    because nTypes was not set, precisely because CheckKeyTypes was not called.
+    
+    Note: yes, CheckKeyTypes is meant to be callable without XkbKeyTypesMask, 
it
+    does properly check for that and just fills nTypes and mapWidths in that
+    case.
+    
+    Signed-off-by: Samuel Thibault <[email protected]>
+    (cherry picked from commit 0217cc6e0cf5013366105a90f5f91ccc4bab5425)
+
+commit f575524314e9f20a1ff639f6bd65386cdbd083f4
+Author: Povilas Kanapickas <[email protected]>
+Date:   Thu Feb 3 20:04:52 2022 +0200
+
+    Revert "os: Try to discover the current seat with the XDG_SEAT var first"
+    
+    This reverts commit b27eaa72837eebe80adfe6c257a71a6b9eaf66ee.
+
+commit 419fbf639d8f53d39449c157a9554bd5482ed64f
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sun Jun 26 10:31:54 2022 -0700
+
+    XQuartz: Add TCC reason keys to Info.plist
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 9ce7264889e36fddbdf6bac332225ad6f628ad5d)
+
+commit 66ac50090dd191f1b16daf338ca3b46d9147fbbd
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sun Jun 26 02:40:20 2022 -0700
+
+    XQuartz: Build the bundle trampoline when using meson
+    
+    This brings the change for e1fdc856aedfcb4788011415930a0c6861df5123 into 
meson based builds
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit b00cf4aef881e00533f995c141c3586749cd7ca1)
+
+commit 033d93a021e86dd5ce9b2b3a1554a72c7031a7f2
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Mon Jun 20 17:08:53 2022 -0700
+
+    meson: Support building Xnest and Xorg on darwin
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit ef8101560eefd6160df6d4b57ddb65ea2328c441)
+
+commit 433f53a1a08390a038176b7c1207512cf1dd3f44
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Mon Jun 20 20:19:06 2022 -0700
+
+    tests: Fix build failure from missing micmap.c
+    
+    FAILED: test/tests
+    clang  -o test/tests test/tests.p/.._mi_miinitext.c.o 
test/tests.p/fixes.c.o test/tests.p/input.c.o test/tests.p/list.c.o 
test/tests.p/misc.c.o test/tests.p/signal-logging.c.o test/tests.p/string.c.o 
test/tests.p/test_xkb.c.o test/tests.p/tests-common.c.o test/tests.p/tests.c.o 
test/tests.p/touch.c.o test/tests.p/xfree86.c.o test/tests.p/xtest.c.o 
test/tests.p/hashtabletest.c.o -Wl,-dead_strip_dylibs 
-Wl,-headerpad_max_install_names -Wl,-undefined,error -fvisibility=hidden -O0 
-g3 -gdwarf-2 -mmacosx-version-min=10.9 -Werror=unguarded-availability-new 
-Werror=format -Werror=objc-method-access -Werror=incompatible-pointer-types 
-F/Applications/Utilities/XQuartz.app/Contents/Frameworks -isysroot 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk -arch x86_64 -O0 -g3 
-gdwarf-2 -mmacosx-version-min=10.9 -Werror=unguarded-availability-new 
-Werror=format -Werror=objc-method-access -Werror=incompatible-pointer-types 
-F/Applications/Utilities/XQuartz.app/Contents/Frameworks -isysroot 
/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk -arch x86_64 
-Wl,-rpath,/opt/X11/lib mi/liblibxserver_mi.a dix/liblibxserver_dix.a 
composite/liblibxserver_composite.a damageext/liblibxserver_damageext.a 
dbe/liblibxserver_dbe.a randr/liblibxserver_randr.a 
miext/damage/liblibxserver_miext_damage.a render/liblibxserver_render.a 
present/liblibxserver_present.a Xext/liblibxserver_xext.a 
miext/sync/liblibxserver_miext_sync.a xfixes/liblibxserver_xfixes.a 
Xi/liblibxserver_xi.a xkb/liblibxserver_xkb.a record/liblibxserver_record.a 
os/liblibxserver_os.a os/liblibxlibc.a glx/liblibglxvnd.a 
hw/xfree86/common/libxorg_common.a hw/xfree86/loader/libxorg_loader.a 
hw/xfree86/ddc/libxorg_ddc.a hw/xfree86/xkb/libxorg_xkb.a 
hw/xfree86/i2c/libxorg_i2c.a hw/xfree86/modes/libxorg_modes.a 
hw/xfree86/os-support/libxorg_os_support.a hw/xfree86/parser/libxorg_parser.a 
hw/xfree86/ramdac/libxorg_ramdac.a fb/liblibxserver_fb.a 
Xext/liblibxserver_xext_vidmode.a dix/liblibxserver_main.a 
config/liblibxserver_config.a /opt/X11/lib/libpixman-1.dylib 
/opt/X11/lib/libxcvt.dylib /opt/X11/lib/libxkbfile.dylib 
/opt/X11/lib/libXfont2.dylib /opt/X11/lib/libXdmcp.dylib -lm 
/opt/X11/lib/libxshmfence.dylib -ldl -lpthread /opt/X11/lib/libXau.dylib 
/opt/X11/lib/libGL.dylib
+    Undefined symbols for architecture x86_64:
+      "_micmapScrPrivateKeyRec", referenced from:
+          _DGAInstallCmap in libxorg_common.a(xf86DGA.c.o)
+          _xf86HandleColormaps in libxorg_common.a(xf86cmap.c.o)
+          _CMapInstallColormap in libxorg_common.a(xf86cmap.c.o)
+          _CMapEnterVT in libxorg_common.a(xf86cmap.c.o)
+          _CMapSwitchMode in libxorg_common.a(xf86cmap.c.o)
+          _CMapSetDGAMode in libxorg_common.a(xf86cmap.c.o)
+          _CMapChangeGamma in libxorg_common.a(xf86cmap.c.o)
+          ...
+    ld: symbol(s) not found for architecture x86_64
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 6645ff59069d603806d749e8af73893cf88d2c06)
+
+commit 3868f364728ae0cc35621bbfdd36bfa2e3f09fda
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Mon Jun 20 20:05:46 2022 -0700
+
+    xf86-input-inputtest: Fix build on systems without SOCK_NONBLOCK
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 707f23dab8787b4154011186206dc9964e2ebc11)
+
+commit afcaaac96767d773422512e755e5ad3691a0627c
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Mon Jun 20 19:51:39 2022 -0700
+
+    print_edid: Fix a format string error
+    
+    ../hw/xfree86/ddc/print_edid.c:511:20: error: format specifies type 
'unsigned short' but the argument has type 'int' [-Werror,-Wformat]
+                       det_mon->type - DS_VENDOR);
+                       ^~~~~~~~~~~~~~~~~~~~~~~~~
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 199b8c0853c92ce19a589186f326621477401b74)
+
+commit 6bb98fc62ddf8b0dd90f7b0b45978a0d0425ed5a
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Tue Jun 21 11:46:14 2022 -0700
+
+    xquartz: Update autotools-based builds of XQuartz to account for recent 
changes
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+
+commit 4ea6f661edbbd84b3f2b308675bd2aa848b53746
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Mon Jun 20 20:32:26 2022 -0700
+
+    Revert "meson: Bump requirement to meson-0.50.0"
+    
+    This bump is causing issues with our CI.  Sorry about that.
+    
+    This reverts commit a6a20a7c40f86b5586286aaa614e6b64a5987d82
+    
+    (cherry picked from commit 8cd0397e5b4c1f0e0add1fea67f82b811214bf3e)
+
+commit a6a20a7c40f86b5586286aaa614e6b64a5987d82
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sun Jun 19 23:06:40 2022 -0700
+
+    meson: Provide options to set CFBundleVersion and CFBundleVersionString in 
XQuartz
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 4f5999826aa478ba5f138e74cfccdf3b854c8e54)
+
+commit 37285e6252ce3afca5bc205121f83271548dfca9
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sun Jun 19 19:56:26 2022 -0700
+
+    xquartz: Update copyright for 2022
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit b12f5dc62d964d0279e1fa9403259cfd8e491285)
+
+commit 96e7b55c5d6898a6715b62d5e01581617d218997
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sun Jun 19 19:55:44 2022 -0700
+
+    xquartz: Update Sparkle configuration to use SUPublicEDKey
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 1d90bef30c4dfe13dd5e70fea606a02380cbcee6)
+
+commit 6465263be8ae98283f8e99a3e95d04e786386040
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sun Jun 19 22:18:16 2022 -0700
+
+    meson: Bump requirement to meson-0.50.0
+    
+    WARNING: Project specifies a minimum meson_version '>= 0.47.0' but uses 
features which were added in newer versions:
+     * 0.50.0: {'install arg in configure_file'}
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 0a27f96d1d0e474b308be982fa7069d3ae0d9892)
+
+commit e48acd9c40c09b7c66a7bfc6650afc216ba78cca
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Thu Jun 16 00:10:26 2022 -0700
+
+    XQuartz: Ensure scroll events are delivered to a single window (not both 
X11 and AppKit)
+    
+    Fixes: https://github.com/XQuartz/XQuartz/issues/130
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 4532b696c644cb7f21e96cf76d3e6b21ccc0e309)
+
+commit 140d9a0f75194d4079d5cd1e4ad4683c6f47683e
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sat Feb 20 14:21:01 2021 -0800
+
+    xquartz: Fold spaces related preferences into 
NSUserDefaults+XQuartzDefaults
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit f40610e0b4f2b4ae54ef6bbff756cb4a60e17e3b)
+
+commit 03ec5b132f0b3e07f9340faaacaa2455717fd8d1
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sat Feb 20 14:00:14 2021 -0800
+
+    xquartz pbproxy: Adopt NSUserDefaults+XQuartzDefaults for preferences
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 6134c73aebc3f928639e8f802be49ec8ecc17e66)
+
+commit 6df6178bb917f596ec2f61a3aabf99eea620b6ec
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Fri Feb 19 22:49:11 2021 -0800
+
+    xquartz: Create a separate category for organizing user preferences
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit 963ba6d9adf578ec8d7ed12ae22dece76b895172)
+
+commit c6c1cba397ffa203123a8a6690dee728089e7325
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sat Sep 10 22:32:56 2016 -0700
+
+    os/connection: Improve abstraction for launchd secure sockets
+    
+    This changes away from hard-coding the /tmp/launch-* path to now
+    supporting a generic <absolute path to unix socket>[.<screen>]
+    format for $DISPLAY.
+    
+    cf-libxcb: d978a4f69b30b630f28d07f1003cf290284d24d8
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    CC: Adam Jackson <[email protected]>
+    (cherry picked from commit 83d0d911069d502232d719882cd1c5cd090defa1)
+
+commit 663af2f17eec2cc064f3d1e25e00fb840c441964
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Sun Jun 12 22:06:01 2022 -0700
+
+    X11Application: Ensure TIS operations are done on the main thread
+    
+    Fixes: https://github.com/XQuartz/XQuartz/issues/205
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit b1afcecc61d841f95e786e4f4f84184f91d149f1)
+
+commit bd3564cf377deace41b359740331d84e3086e916
+Author: Jeremy Huddleston Sequoia <[email protected]>
+Date:   Fri Apr 23 02:15:30 2021 -0700
+
+    rootless: Dead code removal (ROOTLESS_REDISPLAY_DELAY is already defined)
+    
+    Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+    (cherry picked from commit c11b55f3c0c64645bca964aece825de0bdd92b1f)
+
+commit 53173fdab492f0f638f6616fcf01af0b9ea6338d
+Author: Olivier Fourdan <[email protected]>
+Date:   Thu Jan 20 10:20:38 2022 +0100
+
+    render: Fix build with gcc 12
+    
+    The xserver fails to compile with the latest gcc 12:
+    
+     render/picture.c: In function ‘CreateSolidPicture’:
+     render/picture.c:874:26: error: array subscript ‘union _SourcePict[0]’ is 
partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
+      874 |     pPicture->pSourcePict->type = SourcePictTypeSolidFill;
+          |                          ^~
+     render/picture.c:868:45: note: object of size 16 allocated by ‘malloc’
+      868 |     pPicture->pSourcePict = (SourcePictPtr) 
malloc(sizeof(PictSolidFill));
+          |                                             
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+     render/picture.c: In function ‘CreateLinearGradientPicture’:
+     render/picture.c:906:26: error: array subscript ‘union _SourcePict[0]’ is 
partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds]
+      906 |     pPicture->pSourcePict->linear.type = SourcePictTypeLinear;
+          |                          ^~
+     render/picture.c:899:45: note: object of size 32 allocated by ‘malloc’
+      899 |     pPicture->pSourcePict = (SourcePictPtr) 
malloc(sizeof(PictLinearGradient));
+          |                                             
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+     render/picture.c: In function ‘CreateConicalGradientPicture’:
+     render/picture.c:989:26: error: array subscript ‘union _SourcePict[0]’ is 
partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds]
+      989 |     pPicture->pSourcePict->conical.type = SourcePictTypeConical;
+          |                          ^~
+     render/picture.c:982:45: note: object of size 32 allocated by ‘malloc’
+      982 |     pPicture->pSourcePict = (SourcePictPtr) 
malloc(sizeof(PictConicalGradient));
+          |                                             
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+     cc1: some warnings being treated as errors
+     ninja: build stopped: subcommand failed.
+    
+    This is because gcc 12 has become stricter and raises a warning now.
+    
+    Fix the warning/error by allocating enough memory to store the union
+    struct.
+    
+    Signed-off-by: Olivier Fourdan <[email protected]>
+    Acked-by: Michel Dänzer <[email protected]>
+    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1256
+    (cherry picked from commit c6b0dcb82d4db07a2f32c09a8c09c85a5f57248e)
+
+commit 69774044716039fa70655b3bc6dd6a4ff4535cfd
+Author: Błażej Szczygieł <[email protected]>
+Date:   Thu Jan 13 00:47:27 2022 +0100
+
+    present: Check for NULL to prevent crash
+    
+    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1275
+    Signed-off-by: Błażej Szczygieł <[email protected]>
+    Tested-by: Aaron Plattner <[email protected]>
+    (cherry picked from commit 22d5818851967408bb7c903cb345b7ca8766094c)
+
 commit 85397cc2efe8fa73461cd21afe700829b2eca768
 Author: Povilas Kanapickas <[email protected]>
 Date:   Mon Jan 3 00:23:30 2022 +0200
Index: aclocal.m4
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/aclocal.m4,v
retrieving revision 1.37
diff -u -p -u -r1.37 aclocal.m4
--- aclocal.m4  12 Dec 2020 09:30:51 -0000      1.37
+++ aclocal.m4  30 Aug 2022 17:15:38 -0000
@@ -1345,7 +1345,7 @@ m4_include([m4/ltversion.m4])
 m4_include([m4/lt~obsolete.m4])
 dnl fontutil.m4.  Generated from fontutil.m4.in by configure.
 dnl
-dnl This file comes from X.Org's font-util 1.3.2
+dnl This file comes from X.Org's font-util 1.3.3
 dnl
 dnl Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
 dnl
@@ -1410,7 +1410,7 @@ dnl from the copyright holders.
 # See the "minimum version" comment for each macro you use to see what
 # version you require.
 m4_defun([XORG_FONT_MACROS_VERSION],[
-m4_define([vers_have], [1.3.2])
+m4_define([vers_have], [1.3.3])
 m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
 m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
 m4_if(m4_cmp(maj_have, maj_needed), 0,,
Index: configure
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/configure,v
retrieving revision 1.80
diff -u -p -u -r1.80 configure
--- configure   20 Feb 2022 17:41:35 -0000      1.80
+++ configure   30 Aug 2022 17:15:38 -0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xorg-server 21.1.3.
+# Generated by GNU Autoconf 2.69 for xorg-server 21.1.4.
 #
 # Report bugs to <https://gitlab.freedesktop.org/xorg/xserver/issues>.
 #
@@ -651,8 +651,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='xorg-server'
 PACKAGE_TARNAME='xorg-server'
-PACKAGE_VERSION='21.1.3'
-PACKAGE_STRING='xorg-server 21.1.3'
+PACKAGE_VERSION='21.1.4'
+PACKAGE_STRING='xorg-server 21.1.4'
 PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/xserver/issues'
 PACKAGE_URL=''
 
@@ -1986,7 +1986,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures xorg-server 21.1.3 to adapt to many kinds of systems.
+\`configure' configures xorg-server 21.1.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -2057,7 +2057,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of xorg-server 21.1.3:";;
+     short | recursive ) echo "Configuration of xorg-server 21.1.4:";;
    esac
   cat <<\_ACEOF
 
@@ -2246,10 +2246,10 @@ Optional Packages:
                           org.x)
   --with-bundle-version=VERSION
                           Version to use for X11.app's CFBundleVersion
-                          (default: 21.1.3)
+                          (default: 21.1.4)
   --with-bundle-version-string=VERSION
                           Version to use for X11.app's
-                          CFBundleShortVersionString (default: 21.1.3)
+                          CFBundleShortVersionString (default: 21.1.4)
   --with-sparkle-feed-url=URL
                           URL for the Sparkle feed (default:
                           https://www.xquartz.org/releases/sparkle/release.xml)
@@ -2460,7 +2460,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-xorg-server configure 21.1.3
+xorg-server configure 21.1.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -3169,7 +3169,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by xorg-server $as_me 21.1.3, which was
+It was created by xorg-server $as_me 21.1.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3517,7 +3517,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-RELEASE_DATE="2022-01-02"
+RELEASE_DATE="2022-07-12"
 RELEASE_NAME="Caramel Ice Cream"
 
 
@@ -3997,7 +3997,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='xorg-server'
- VERSION='21.1.3'
+ VERSION='21.1.4'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -22895,7 +22895,7 @@ _ACEOF
 if test "${with_bundle_version+set}" = set; then :
   withval=$with_bundle_version;  BUNDLE_VERSION="${withval}"
 else
-   BUNDLE_VERSION="21.1.3"
+   BUNDLE_VERSION="21.1.4"
 fi
 
 
@@ -31541,7 +31541,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by xorg-server $as_me 21.1.3, which was
+This file was extended by xorg-server $as_me 21.1.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -31607,7 +31607,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-xorg-server config.status 21.1.3
+xorg-server config.status 21.1.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
Index: configure.ac
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/configure.ac,v
retrieving revision 1.75
diff -u -p -u -r1.75 configure.ac
--- configure.ac        20 Feb 2022 17:41:35 -0000      1.75
+++ configure.ac        30 Aug 2022 17:15:38 -0000
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 21.1.3, 
[https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server)
-RELEASE_DATE="2022-01-02"
+AC_INIT([xorg-server], 21.1.4, 
[https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server)
+RELEASE_DATE="2022-07-12"
 RELEASE_NAME="Caramel Ice Cream"
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_MACRO_DIR([m4])
Index: meson_options.txt
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/meson_options.txt,v
retrieving revision 1.2
diff -u -p -u -r1.2 meson_options.txt
--- meson_options.txt   11 Nov 2021 09:03:02 -0000      1.2
+++ meson_options.txt   30 Aug 2022 17:15:38 -0000
@@ -116,8 +116,14 @@ option('apple-application-name', type: '
         description: 'Application name')
 option('bundle-id-prefix', type: 'string', value: 'org.x',
         description: 'RDNS prefix for bundle identifier')
+option('bundle-version', type: 'string', value: 'auto',
+        description: 'The CFBundleVersion for the application bundle')
+option('bundle-version-string', type: 'string', value: 'auto',
+        description: 'The CFBundleShortVersionString for the application 
bundle')
 option('sparkle-feed-url', type: 'string',
         description: 'Feed URL for autoupdating with the Sparkle Framework 
(default: disabled)')
+option('sparkle-public-edkey', type: 'string',
+        description: 'Public EdDSA key for verifying updates from the Sparkle 
feed (default: disabled)')
 option('xpbproxy', type: 'boolean', value: false,
         description: 'Build a standalone X pasteboard proxy')
 
Index: Xi/exevents.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/Xi/exevents.c,v
retrieving revision 1.25
diff -u -p -u -r1.25 exevents.c
--- Xi/exevents.c       17 Nov 2021 19:46:39 -0000      1.25
+++ Xi/exevents.c       30 Aug 2022 17:15:38 -0000
@@ -1524,7 +1524,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr d
             g = AllocGrab(devgrab);
             BUG_WARN(!g);
 
-            *dev->deviceGrab.sync.event = *ev;
+            CopyPartialInternalEvent(dev->deviceGrab.sync.event, ev);
 
             /* The listener array has a sequence of grabs and then one event
              * selection. Implicit grab activation occurs through delivering an
Index: dix/events.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/dix/events.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 events.c
--- dix/events.c        17 Nov 2021 19:46:39 -0000      1.23
+++ dix/events.c        30 Aug 2022 17:15:38 -0000
@@ -467,6 +467,20 @@ WindowXI2MaskIsset(DeviceIntPtr dev, Win
     return xi2mask_isset(inputMasks->xi2mask, dev, evtype);
 }
 
+/**
+ * When processing events we operate on InternalEvent pointers. They may 
actually refer to a
+ * an instance of DeviceEvent, GestureEvent or any other event that comprises 
the InternalEvent
+ * union. This works well in practice because we always look into event type 
before doing anything,
+ * except in the case of copying the event. Any copying of InternalEvent 
should use this function
+ * instead of doing *dst_event = *src_event whenever it's not clear whether 
source event actually
+ * points to full InternalEvent instance.
+ */
+void
+CopyPartialInternalEvent(InternalEvent* dst_event, const InternalEvent* 
src_event)
+{
+    memcpy(dst_event, src_event, src_event->any.length);
+}
+
 Mask
 GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients * other)
 {
@@ -1491,16 +1505,13 @@ UpdateTouchesForGrab(DeviceIntPtr mouse)
             CLIENT_BITS(listener->listener) == grab->resource) {
             if (grab->grabtype == CORE || grab->grabtype == XI ||
                 !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) {
+                /*  Note that the grab will override any current listeners and 
if these listeners
+                    already received touch events then this is the place to 
send touch end event
+                    to complete the touch sequence.
 
-                if (listener->type == TOUCH_LISTENER_REGULAR &&
-                    listener->state != TOUCH_LISTENER_AWAITING_BEGIN &&
-                    listener->state != TOUCH_LISTENER_HAS_END) {
-                    /* if the listener already got any events relating to the 
touch, we must send
-                       a touch end because the grab overrides the previous 
listener and won't
-                       itself send any touch events.
-                    */
-                    TouchEmitTouchEnd(mouse, ti, 0, listener->listener);
-                }
+                    Unfortunately GTK3 menu widget implementation relies on 
not getting touch end
+                    event, so we can't fix the current behavior.
+                */
                 listener->type = TOUCH_LISTENER_POINTER_GRAB;
             } else {
                 listener->type = TOUCH_LISTENER_GRAB;
@@ -3873,7 +3884,7 @@ void ActivateGrabNoDelivery(DeviceIntPtr
 
     if (grabinfo->sync.state == FROZEN_NO_EVENT)
         grabinfo->sync.state = FROZEN_WITH_EVENT;
-    *grabinfo->sync.event = *real_event;
+    CopyPartialInternalEvent(grabinfo->sync.event, real_event);
 }
 
 static BOOL
@@ -4455,7 +4466,7 @@ FreezeThisEventIfNeededForSyncGrab(Devic
     case FREEZE_NEXT_EVENT:
         grabinfo->sync.state = FROZEN_WITH_EVENT;
         FreezeThaw(thisDev, TRUE);
-        *grabinfo->sync.event = *event;
+        CopyPartialInternalEvent(grabinfo->sync.event, event);
         break;
     }
 }
Index: hw/xfree86/ddc/print_edid.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/hw/xfree86/ddc/print_edid.c,v
retrieving revision 1.7
diff -u -p -u -r1.7 print_edid.c
--- hw/xfree86/ddc/print_edid.c 11 Nov 2021 09:03:05 -0000      1.7
+++ hw/xfree86/ddc/print_edid.c 30 Aug 2022 17:15:38 -0000
@@ -507,7 +507,7 @@ handle_detailed_print(struct detailed_mo
     }
     if (det_mon->type >= DS_VENDOR && det_mon->type <= DS_VENDOR_MAX) {
         xf86DrvMsg(scrnIndex, X_INFO,
-                   "Unknown vendor-specific block %hx\n",
+                   "Unknown vendor-specific block %x\n",
                    det_mon->type - DS_VENDOR);
     }
 
Index: hw/xfree86/drivers/inputtest/xf86-input-inputtest.c
===================================================================
RCS file: 
/cvs/OpenBSD/xenocara/xserver/hw/xfree86/drivers/inputtest/xf86-input-inputtest.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 xf86-input-inputtest.c
--- hw/xfree86/drivers/inputtest/xf86-input-inputtest.c 11 Nov 2021 09:03:06 
-0000      1.1
+++ hw/xfree86/drivers/inputtest/xf86-input-inputtest.c 30 Aug 2022 17:15:38 
-0000
@@ -856,39 +856,48 @@ read_input_from_connection(InputInfoPtr 
         driver_data->buffer.valid_length += read_size;
 
         while (1) {
-            xf86ITEventHeader *event_header;
+            xf86ITEventHeader event_header;
             char *event_begin = driver_data->buffer.data + processed_size;
 
             if (driver_data->buffer.valid_length - processed_size < 
sizeof(xf86ITEventHeader))
                 break;
 
-            event_header = (xf86ITEventHeader*) event_begin;
+            /* Note that event_begin pointer is not aligned, accessing it 
directly is
+               undefined behavior. We must use memcpy to copy the data to 
aligned data
+               area. Most compilers will optimize out this call out and use 
whatever
+               is most efficient to access unaligned data on a particular 
platform */
+            memcpy(&event_header, event_begin, sizeof(xf86ITEventHeader));
 
-            if (event_header->length >= EVENT_BUFFER_SIZE) {
+            if (event_header.length >= EVENT_BUFFER_SIZE) {
                 xf86IDrvMsg(pInfo, X_ERROR, "Received event with too long 
length: %d\n",
-                            event_header->length);
+                            event_header.length);
                 teardown_client_connection(pInfo);
                 return;
             }
 
-            if (driver_data->buffer.valid_length - processed_size < 
event_header->length)
+            if (driver_data->buffer.valid_length - processed_size < 
event_header.length)
                 break;
 
-            if (is_supported_event(event_header->type)) {
-                int expected_event_size = get_event_size(event_header->type);
+            if (is_supported_event(event_header.type)) {
+                int expected_event_size = get_event_size(event_header.type);
 
-                if (event_header->length != expected_event_size) {
+                if (event_header.length != expected_event_size) {
                     xf86IDrvMsg(pInfo, X_ERROR, "Unexpected event length: was 
%d bytes, "
                                 "expected %d (event type: %d)\n",
-                                event_header->length, expected_event_size,
-                                (int) event_header->type);
+                                event_header.length, expected_event_size,
+                                (int) event_header.type);
                     teardown_client_connection(pInfo);
                     return;
                 }
 
-                handle_event(pInfo, (xf86ITEventAny*) event_begin);
+                /* We could use event_begin pointer directly, but we want to 
ensure correct
+                   data alignment (if only so that address sanitizer does not 
complain) */
+                xf86ITEventAny event_data;
+                memset(&event_data, 0, sizeof(event_data));
+                memcpy(&event_data, event_begin, event_header.length);
+                handle_event(pInfo, &event_data);
             }
-            processed_size += event_header->length;
+            processed_size += event_header.length;
         }
 
         if (processed_size > 0) {
@@ -1005,7 +1014,19 @@ pre_init(InputDriverPtr drv, InputInfoPt
 
     unlink(driver_data->socket_path);
 
+#ifdef SOCK_NONBLOCK
     driver_data->socket_fd = socket(PF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
+#else
+    int fd = socket(PF_UNIX, SOCK_STREAM, 0);
+    if (fd >= 0) {
+        flags = fcntl(fd, F_GETFL, 0);
+        if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
+            fd = -1;
+        }
+    }
+    driver_data->socket_fd = fd;
+#endif
+
     if (driver_data->socket_fd < 0) {
         xf86IDrvMsg(pInfo, X_ERROR, "Failed to create a socket for 
communication: %s\n",
                     strerror(errno));
Index: include/input.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/include/input.h,v
retrieving revision 1.17
diff -u -p -u -r1.17 input.h
--- include/input.h     11 Nov 2021 09:03:13 -0000      1.17
+++ include/input.h     30 Aug 2022 17:15:39 -0000
@@ -676,6 +676,7 @@ extern void GestureEmitGestureEndToOwner
 extern void ProcessGestureEvent(InternalEvent *ev, DeviceIntPtr dev);
 
 /* misc event helpers */
+extern void CopyPartialInternalEvent(InternalEvent* dst_event, const 
InternalEvent* src_event);
 extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr 
clients);
 extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
 extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent *ev);
Index: miext/rootless/rootlessScreen.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/miext/rootless/rootlessScreen.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 rootlessScreen.c
--- miext/rootless/rootlessScreen.c     11 Nov 2021 09:03:14 -0000      1.13
+++ miext/rootless/rootlessScreen.c     30 Aug 2022 17:15:39 -0000
@@ -51,11 +51,6 @@
 #include "rootlessCommon.h"
 #include "rootlessWindow.h"
 
-/* In milliseconds */
-#ifndef ROOTLESS_REDISPLAY_DELAY
-#define ROOTLESS_REDISPLAY_DELAY 10
-#endif
-
 extern int RootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild,
                                   VTKind kind);
 extern Bool RootlessCreateGC(GCPtr pGC);
Index: os/connection.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/os/connection.c,v
retrieving revision 1.24
diff -u -p -u -r1.24 connection.c
--- os/connection.c     11 Nov 2021 09:03:14 -0000      1.24
+++ os/connection.c     30 Aug 2022 17:15:39 -0000
@@ -79,6 +79,8 @@ SOFTWARE.
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <sys/stat.h>
+
 #ifndef WIN32
 #include <sys/socket.h>
 
@@ -1006,15 +1008,34 @@ MakeClientGrabPervious(ClientPtr client)
 void
 ListenOnOpenFD(int fd, int noxauth)
 {
-    char port[256];
+    char port[PATH_MAX];
     XtransConnInfo ciptr;
     const char *display_env = getenv("DISPLAY");
 
-    if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) {
-        /* Make the path the launchd socket if our DISPLAY is set right */
-        strcpy(port, display_env);
+    /* First check if display_env matches a <absolute path to unix 
socket>[.<screen number>] scheme (eg: launchd) */
+    if (display_env && display_env[0] == '/') {
+        struct stat sbuf;
+
+        strlcpy(port, display_env, sizeof(port));
+
+        /* If the path exists, we don't have do do anything else.
+         * If it doesn't, we need to check for a .<screen number> to strip off 
and recheck.
+         */
+        if (0 != stat(port, &sbuf)) {
+            char *dot = strrchr(port, '.');
+            if (dot) {
+                *dot = '\0';
+
+                if (0 != stat(port, &sbuf)) {
+                    display_env = NULL;
+                }
+            } else {
+                display_env = NULL;
+            }
+        }
     }
-    else {
+
+    if (!display_env) {
         /* Just some default so things don't break and die. */
         snprintf(port, sizeof(port), ":%d", atoi(display));
     }
Index: os/utils.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/os/utils.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 utils.c
--- os/utils.c  20 Feb 2022 17:41:35 -0000      1.28
+++ os/utils.c  30 Aug 2022 17:15:39 -0000
@@ -693,7 +693,6 @@ ProcessCommandLine(int argc, char *argv[
                     ErrorF("Failed to disable listen for %s transport",
                            defaultNoListenList[i]);
     }
-    SeatId = getenv("XDG_SEAT");
 
     for (i = 1; i < argc; i++) {
         /* call ddx first, so it can peek/override if it wants */
Index: present/present_scmd.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/present/present_scmd.c,v
retrieving revision 1.5
diff -u -p -u -r1.5 present_scmd.c
--- present/present_scmd.c      11 Nov 2021 09:03:14 -0000      1.5
+++ present/present_scmd.c      30 Aug 2022 17:15:39 -0000
@@ -158,6 +158,9 @@ present_scmd_get_crtc(present_screen_pri
     if (!screen_priv->info)
         return NULL;
 
+    if (!screen_priv->info->get_crtc)
+        return NULL;
+
     return (*screen_priv->info->get_crtc)(window);
 }
 
@@ -194,6 +197,9 @@ present_flush(WindowPtr window)
         return;
 
     if (!screen_priv->info)
+        return;
+
+    if (!screen_priv->info->flush)
         return;
 
     (*screen_priv->info->flush) (window);
Index: render/picture.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/xserver/render/picture.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 picture.c
--- render/picture.c    11 Nov 2021 09:03:15 -0000      1.14
+++ render/picture.c    30 Aug 2022 17:15:39 -0000
@@ -865,7 +865,7 @@ CreateSolidPicture(Picture pid, xRenderC
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
         free(pPicture);
@@ -896,7 +896,7 @@ CreateLinearGradientPicture(Picture pid,
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
         free(pPicture);
@@ -936,7 +936,7 @@ CreateRadialGradientPicture(Picture pid,
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictRadialGradient));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
         free(pPicture);
@@ -979,7 +979,7 @@ CreateConicalGradientPicture(Picture pid
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) 
malloc(sizeof(PictConicalGradient));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(SourcePict));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
         free(pPicture);


-- 
Matthieu Herrb

Reply via email to