summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-graphics/xorg-lib/libx11/CVE-2023-3138.patch111
-rw-r--r--meta/recipes-graphics/xorg-lib/libx11_1.7.3.1.bb1
2 files changed, 112 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-lib/libx11/CVE-2023-3138.patch b/meta/recipes-graphics/xorg-lib/libx11/CVE-2023-3138.patch
new file mode 100644
index 0000000000..c724cf8fdd
--- /dev/null
+++ b/meta/recipes-graphics/xorg-lib/libx11/CVE-2023-3138.patch
@@ -0,0 +1,111 @@
1From 304a654a0d57bf0f00d8998185f0360332cfa36c Mon Sep 17 00:00:00 2001
2From: Alan Coopersmith <alan.coopersmith@oracle.com>
3Date: Sat, 10 Jun 2023 16:30:07 -0700
4Subject: [PATCH] InitExt.c: Add bounds checks for extension request, event, &
5 error codes
6
7Fixes CVE-2023-3138: X servers could return values from XQueryExtension
8that would cause Xlib to write entries out-of-bounds of the arrays to
9store them, though this would only overwrite other parts of the Display
10struct, not outside the bounds allocated for that structure.
11
12Reported-by: Gregory James DUCK <gjduck@gmail.com>
13Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
14
15CVE: CVE-2023-3138
16Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/304a654a0d57bf0f00d8998185f0360332cfa36c.patch]
17Signed-off-by: Poonam Jadhav <poonam.jadhav@kpit.com>
18---
19 src/InitExt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
20 1 file changed, 42 insertions(+)
21
22diff --git a/src/InitExt.c b/src/InitExt.c
23index 4de46f15..afc00a6b 100644
24--- a/src/InitExt.c
25+++ b/src/InitExt.c
26@@ -33,6 +33,18 @@ from The Open Group.
27 #include <X11/Xos.h>
28 #include <stdio.h>
29
30+/* The X11 protocol spec reserves events 64 through 127 for extensions */
31+#ifndef LastExtensionEvent
32+#define LastExtensionEvent 127
33+#endif
34+
35+/* The X11 protocol spec reserves requests 128 through 255 for extensions */
36+#ifndef LastExtensionRequest
37+#define FirstExtensionRequest 128
38+#define LastExtensionRequest 255
39+#endif
40+
41+
42 /*
43 * This routine is used to link a extension in so it will be called
44 * at appropriate times.
45@@ -242,6 +254,12 @@ WireToEventType XESetWireToEvent(
46 WireToEventType proc) /* routine to call when converting event */
47 {
48 register WireToEventType oldproc;
49+ if (event_number < 0 ||
50+ event_number > LastExtensionEvent) {
51+ fprintf(stderr, "Xlib: ignoring invalid extension event %d\n",
52+ event_number);
53+ return (WireToEventType)_XUnknownWireEvent;
54+ }
55 if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent;
56 LockDisplay (dpy);
57 oldproc = dpy->event_vec[event_number];
58@@ -263,6 +281,12 @@ WireToEventCookieType XESetWireToEventCookie(
59 )
60 {
61 WireToEventCookieType oldproc;
62+ if (extension < FirstExtensionRequest ||
63+ extension > LastExtensionRequest) {
64+ fprintf(stderr, "Xlib: ignoring invalid extension opcode %d\n",
65+ extension);
66+ return (WireToEventCookieType)_XUnknownWireEventCookie;
67+ }
68 if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie;
69 LockDisplay (dpy);
70 oldproc = dpy->generic_event_vec[extension & 0x7F];
71@@ -284,6 +308,12 @@ CopyEventCookieType XESetCopyEventCookie(
72 )
73 {
74 CopyEventCookieType oldproc;
75+ if (extension < FirstExtensionRequest ||
76+ extension > LastExtensionRequest) {
77+ fprintf(stderr, "Xlib: ignoring invalid extension opcode %d\n",
78+ extension);
79+ return (CopyEventCookieType)_XUnknownCopyEventCookie;
80+ }
81 if (proc == NULL) proc = (CopyEventCookieType)_XUnknownCopyEventCookie;
82 LockDisplay (dpy);
83 oldproc = dpy->generic_event_copy_vec[extension & 0x7F];
84@@ -305,6 +335,12 @@ EventToWireType XESetEventToWire(
85 EventToWireType proc) /* routine to call when converting event */
86 {
87 register EventToWireType oldproc;
88+ if (event_number < 0 ||
89+ event_number > LastExtensionEvent) {
90+ fprintf(stderr, "Xlib: ignoring invalid extension event %d\n",
91+ event_number);
92+ return (EventToWireType)_XUnknownNativeEvent;
93+ }
94 if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent;
95 LockDisplay (dpy);
96 oldproc = dpy->wire_vec[event_number];
97@@ -325,6 +361,12 @@ WireToErrorType XESetWireToError(
98 WireToErrorType proc) /* routine to call when converting error */
99 {
100 register WireToErrorType oldproc = NULL;
101+ if (error_number < 0 ||
102+ error_number > LastExtensionError) {
103+ fprintf(stderr, "Xlib: ignoring invalid extension error %d\n",
104+ error_number);
105+ return (WireToErrorType)_XDefaultWireError;
106+ }
107 if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError;
108 LockDisplay (dpy);
109 if (!dpy->error_vec) {
110--
111GitLab
diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.7.3.1.bb b/meta/recipes-graphics/xorg-lib/libx11_1.7.3.1.bb
index 3e6b50c0a3..19687d546b 100644
--- a/meta/recipes-graphics/xorg-lib/libx11_1.7.3.1.bb
+++ b/meta/recipes-graphics/xorg-lib/libx11_1.7.3.1.bb
@@ -17,6 +17,7 @@ SRC_URI = "${XORG_MIRROR}/individual/lib/${XORG_PN}-${PV}.tar.xz"
17SRC_URI += "file://disable_tests.patch \ 17SRC_URI += "file://disable_tests.patch \
18 file://CVE-2022-3554.patch \ 18 file://CVE-2022-3554.patch \
19 file://CVE-2022-3555.patch \ 19 file://CVE-2022-3555.patch \
20 file://CVE-2023-3138.patch \
20 " 21 "
21SRC_URI[sha256sum] = "2ffd417266fb875028fdc0ef349694f63dbcd76d0b0cfacfb52e6151f4b60989" 22SRC_URI[sha256sum] = "2ffd417266fb875028fdc0ef349694f63dbcd76d0b0cfacfb52e6151f4b60989"
22 23