summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-02-06 22:05:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-08 21:21:04 +0000
commit2555e58e56b5273adf8fb716eb3b28dcb69e686a (patch)
treef3d2c33a38e9ab8f4d253f531a13658d3bd38eb5
parent50ee75aaa2d436f02e0f71739b149a4b4d8a9c7d (diff)
downloadpoky-2555e58e56b5273adf8fb716eb3b28dcb69e686a.tar.gz
libx11: backport _XEatDataWords API
If you build libx11-native then that has to be ABI-compatible with the libX11 on the host or you'll have problems running qemu-native. Most current distros are using libX11 1.6+. Thus, we need to backport the _XEatDataWords API present in 1.6. This only affects the dylan branch as dora+ has libx11 1.6+. Fixes [YOCTO #5040]. (From OE-Core rev: ce8deda64f78ac48820d06c4f90c20a31f9e3eed) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-graphics/xorg-lib/libx11/xeatdatawords.patch65
-rw-r--r--meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb1
2 files changed, 66 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-lib/libx11/xeatdatawords.patch b/meta/recipes-graphics/xorg-lib/libx11/xeatdatawords.patch
new file mode 100644
index 0000000000..63fac8b9cf
--- /dev/null
+++ b/meta/recipes-graphics/xorg-lib/libx11/xeatdatawords.patch
@@ -0,0 +1,65 @@
1From 9f5d83706543696fc944c1835a403938c06f2cc5 Mon Sep 17 00:00:00 2001
2From: Alan Coopersmith <alan.coopersmith@oracle.com>
3Date: Sat, 02 Mar 2013 04:54:24 +0000
4Subject: Add _XEatDataWords to discard a given number of 32-bit words of reply data
5
6Matches the units of the length field in X protocol replies, and provides
7a single implementation of overflow checking to avoid having to replicate
8those checks in every caller.
9
10Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
11Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
12
13Upstream-Status: Backport
14Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
15
16---
17diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
18index 06395b3..d63a534 100644
19--- a/include/X11/Xlibint.h
20+++ b/include/X11/Xlibint.h
21@@ -855,6 +855,10 @@ extern void _XEatData(
22 Display* /* dpy */,
23 unsigned long /* n */
24 );
25+extern void _XEatDataWords(
26+ Display* /* dpy */,
27+ unsigned long /* n */
28+);
29 extern char *_XAllocScratch(
30 Display* /* dpy */,
31 unsigned long /* nbytes */
32diff --git a/src/xcb_io.c b/src/xcb_io.c
33index 300ef57..727c6c7 100644
34--- a/src/xcb_io.c
35+++ b/src/xcb_io.c
36@@ -19,6 +19,7 @@
37 #include <stdint.h>
38 #include <stdlib.h>
39 #include <string.h>
40+#include <limits.h>
41 #ifdef HAVE_SYS_SELECT_H
42 #include <sys/select.h>
43 #endif
44@@ -757,3 +758,19 @@ void _XEatData(Display *dpy, unsigned long n)
45 dpy->xcb->reply_consumed += n;
46 _XFreeReplyData(dpy, False);
47 }
48+
49+/*
50+ * Read and discard "n" 32-bit words of data
51+ * Matches the units of the length field in X protocol replies, and provides
52+ * a single implementation of overflow checking to avoid having to replicate
53+ * those checks in every caller.
54+ */
55+void _XEatDataWords(Display *dpy, unsigned long n)
56+{
57+ if (n < ((INT_MAX - dpy->xcb->reply_consumed) >> 2))
58+ dpy->xcb->reply_consumed += (n << 2);
59+ else
60+ /* Overflow would happen, so just eat the rest of the reply */
61+ dpy->xcb->reply_consumed = dpy->xcb->reply_length;
62+ _XFreeReplyData(dpy, False);
63+}
64--
65cgit v0.9.0.2-2-gbebe
diff --git a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
index 7f18824850..95d5c7d8e2 100644
--- a/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
+++ b/meta/recipes-graphics/xorg-lib/libx11_1.5.0.bb
@@ -7,6 +7,7 @@ BBCLASSEXTEND = "native nativesdk"
7 7
8SRC_URI += "file://keysymdef_include.patch \ 8SRC_URI += "file://keysymdef_include.patch \
9 file://disable_tests.patch \ 9 file://disable_tests.patch \
10 file://xeatdatawords.patch \
10 " 11 "
11 12
12SRC_URI[md5sum] = "78b4b3bab4acbdf0abcfca30a8c70cc6" 13SRC_URI[md5sum] = "78b4b3bab4acbdf0abcfca30a8c70cc6"