From 2e8a19529d8f9c3eb702984a9c4ff344beb1e373 Mon Sep 17 00:00:00 2001
From: Upgrade Helper <auh@yoctoproject.org>
Date: Tue, 15 Nov 2022 11:02:31 +0000
Subject: [PATCH] libx11: upgrade 1.8.1 -> 1.8.2

---
 ...ak-in-XRegisterIMInstantiateCallback.patch | 57 ------------
 .../{libx11_1.8.1.bb => libx11_1.8.2.bb}      | 90 +++++++++++++++++--
 2 files changed, 84 insertions(+), 63 deletions(-)
 delete mode 100644 meta/recipes-graphics/xorg-lib/libx11/0001-fix-a-memory-leak-in-XRegisterIMInstantiateCallback.patch
 rename meta/recipes-graphics/xorg-lib/{libx11_1.8.1.bb => libx11_1.8.2.bb} (25%)

diff --git a/meta/recipes-graphics/xorg-lib/libx11/0001-fix-a-memory-leak-in-XRegisterIMInstantiateCallback.patch b/meta/recipes-graphics/xorg-lib/libx11/0001-fix-a-memory-leak-in-XRegisterIMInstantiateCallback.patch
deleted file mode 100644
index 722116c07e..0000000000
--- a/meta/recipes-graphics/xorg-lib/libx11/0001-fix-a-memory-leak-in-XRegisterIMInstantiateCallback.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-CVE: CVE-2022-3554
-Upstream-Status: Backport
-Signed-off-by: Ross Burton <ross.burton@arm.com>
-
-From 1d11822601fd24a396b354fa616b04ed3df8b4ef Mon Sep 17 00:00:00 2001
-From: "Thomas E. Dickey" <dickey@invisible-island.net>
-Date: Tue, 4 Oct 2022 18:26:17 -0400
-Subject: [PATCH] fix a memory leak in XRegisterIMInstantiateCallback
-
-Analysis:
-
-    _XimRegisterIMInstantiateCallback() opens an XIM and closes it using
-    the internal function pointers, but the internal close function does
-    not free the pointer to the XIM (this would be done in XCloseIM()).
-
-Report/patch:
-
-    Date: Mon, 03 Oct 2022 18:47:32 +0800
-    From: Po Lu <luangruo@yahoo.com>
-    To: xorg-devel@lists.x.org
-    Subject: Re: Yet another leak in Xlib
-
-    For reference, here's how I'm calling XRegisterIMInstantiateCallback:
-
-    XSetLocaleModifiers ("");
-    XRegisterIMInstantiateCallback (compositor.display,
-                                    XrmGetDatabase (compositor.display),
-                                    (char *) compositor.resource_name,
-                                    (char *) compositor.app_name,
-                                    IMInstantiateCallback, NULL);
-
-    and XMODIFIERS is:
-
-        @im=ibus
-
-Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
----
- modules/im/ximcp/imInsClbk.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/modules/im/ximcp/imInsClbk.c b/modules/im/ximcp/imInsClbk.c
-index 95b379cb..c10e347f 100644
---- a/modules/im/ximcp/imInsClbk.c
-+++ b/modules/im/ximcp/imInsClbk.c
-@@ -212,6 +212,9 @@ _XimRegisterIMInstantiateCallback(
-     if( xim ) {
- 	lock = True;
- 	xim->methods->close( (XIM)xim );
-+	/* XIMs must be freed manually after being opened; close just
-+	   does the protocol to deinitialize the IM.  */
-+	XFree( xim );
- 	lock = False;
- 	icb->call = True;
- 	callback( display, client_data, NULL );
--- 
-2.34.1
-
diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb b/meta/recipes-graphics/xorg-lib/libx11_1.8.2.bb
similarity index 25%
rename from meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb
rename to meta/recipes-graphics/xorg-lib/libx11_1.8.2.bb
index 9ff196c897..743b7a114b 100644
--- a/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb
+++ b/meta/recipes-graphics/xorg-lib/libx11_1.8.2.bb
@@ -1,3 +1,82 @@
+# FIXME: the LIC_FILES_CHKSUM values have been updated by 'devtool upgrade'.
+# The following is the difference between the old and the new license text.
+# Please update the LICENSE value if needed, and summarize the changes in
+# the commit message via 'License-Update:' tag.
+# (example: 'License-Update: copyright years updated.')
+#
+# The changes:
+#
+# --- COPYING
+# +++ COPYING
+# @@ -13,8 +13,7 @@
+#  
+#  Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett
+#  Copyright © 2009 Red Hat, Inc.
+# -Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates.
+# -All rights reserved.
+# +Copyright (c) 1990-1992, 1999, 2000, 2004, 2009, 2010, 2015, 2017, Oracle and/or its affiliates.
+#  
+#  Permission is hereby granted, free of charge, to any person obtaining a
+#  copy of this software and associated documentation files (the "Software"),
+# @@ -228,35 +227,6 @@
+#  
+#  		----------------------------------------
+#  
+# -
+# -Copyright (c) 1995 David E. Wexelblat.  All rights reserved
+# -
+# -Permission is hereby granted, free of charge, to any person obtaining
+# -a copy of this software and associated documentation files (the
+# -"Software"), to deal in the Software without restriction, including
+# -without limitation the rights to use, copy, modify, merge, publish,
+# -distribute, sublicense, and/or sell copies of the Software, and to
+# -permit persons to whom the Software is furnished to do so, subject to
+# -the following conditions:
+# -
+# -The above copyright notice and this permission notice shall be included
+# -in all copies or substantial portions of the Software.
+# -
+# -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# -IN NO EVENT SHALL DAVID E. WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# -OTHER DEALINGS IN THE SOFTWARE.
+# -
+# -Except as contained in this notice, the name of David E. Wexelblat shall
+# -not be used in advertising or otherwise to promote the sale, use or
+# -other dealings in this Software without prior written authorization
+# -from David E. Wexelblat.
+# -
+# -		----------------------------------------
+# -
+#  Copyright 1990, 1991 by OMRON Corporation
+#  
+#  Permission to use, copy, modify, distribute, and sell this software and its
+# @@ -940,3 +910,19 @@
+#  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+#  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#  
+# +		----------------------------------------
+# +
+# +Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
+# +
+# +Permission to use, copy, modify, and distribute this software for any
+# +purpose with or without fee is hereby granted, provided that the above
+# +copyright notice and this permission notice appear in all copies.
+# +
+# +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+# +
+# 
+#
+
 SUMMARY = "Xlib: C Language X Interface library"
 
 DESCRIPTION = "This package provides a client interface to the X Window \
@@ -12,18 +91,17 @@ PE = "1"
 
 # temporarily override SRC_URI which is hard-coded in xorg-lib-common.inc
 # since new versions of packages use a new compression format - .tar.gz
-SRC_URI = "${XORG_MIRROR}/individual/lib/${XORG_PN}-${PV}.tar.xz"
-
-SRC_URI += "file://disable_tests.patch \
-            file://0001-fix-a-memory-leak-in-XRegisterIMInstantiateCallback.patch \
+SRC_URI = "${XORG_MIRROR}/individual/lib/${XORG_PN}-${PV}.tar.xz \
+           file://disable_tests.patch \
            "
-SRC_URI[sha256sum] = "1bc41aa1bbe01401f330d76dfa19f386b79c51881c7bbfee9eb4e27f22f2d9f7"
+
+SRC_URI[sha256sum] = "ed91d573d570db83b8ae546f4890dccfcd0b9dfe1e50a1b401b63a74c152ed04"
 
 PROVIDES = "virtual/libx11"
 
 XORG_PN = "libX11"
 LICENSE = "MIT & MIT & BSD-1-Clause & HPND & HPND-sell-variant"
-LIC_FILES_CHKSUM = "file://COPYING;md5=172255dee66bb0151435b2d5d709fcf7"
+LIC_FILES_CHKSUM = "file://COPYING;md5=1d49cdd2b386c5db11ec636d680b7116"
 
 DEPENDS += "xorgproto \
             xtrans \
-- 
2.31.1

