Timo Aaltonen
2018-10-09 15:04:02 UTC
Timo Aaltonen pushed to branch upstream-unstable at X Strike Force / lib / libx11
Commits:
d0416863 by Bhavi Dhingra at 2018-09-22T23:21:14Z
XcmsLookupColor: fully initialize XColor structs passed to _XColor_to_XcmsRGB
Fixes https://gitlab.freedesktop.org/xorg/lib/libx11/issues/44
aka https://bugs.freedesktop.org/show_bug.cgi?id=92154
Reviewed-by: Alan Coopersmith <***@oracle.com>
Signed-off-by: Alan Coopersmith <***@oracle.com>
- - - - -
406afe4b by Michel Dänzer at 2018-09-25T15:10:58Z
poll_for_response: Call poll_for_event again if xcb_poll_for_reply fails
If xcb_poll_for_reply fails to find a reply, poll_for_response would
always return NULL. However, xcb_poll_for_reply may have read events
from the display connection while looking for a reply. In that case,
returning NULL from poll_for_response is wrong and can result in the
client hanging, e.g. because it returns to waiting for the display
connection file descriptor becoming readable after XPending incorrectly
returned 0 pending events.
The solution is to call poll_for_event again after xcb_poll_for_reply
returned 0. This will return the first of any events read by
xcb_poll_for_reply.
Fixes issue #79.
Reported-by: Yuxuan Shui <***@gmail.com>
Bugzilla: https://bugs.freedesktop.org/108008
Bugzilla: https://bugs.freedesktop.org/107992
Reviewed-by: Adam Jackson <***@redhat.com>
- - - - -
823a0f8a by Michel Dänzer at 2018-09-28T15:24:17Z
poll_for_event: Allow using xcb_poll_for_queued_event
It avoids reading from the display connection again in cases where that
was already done.
Suggested-by: Uli Schlachter <***@znc.in>
Reviewed-by: Uli Schlachter <***@znc.in>
- - - - -
f3c97847 by Matt Turner at 2018-10-09T14:26:12Z
libX11 1.6.7
Signed-off-by: Matt Turner <***@gmail.com>
- - - - -
3 changed files:
- configure.ac
- src/xcb_io.c
- src/xcms/cmsLkCol.c
Changes:
=====================================
configure.ac
=====================================
@@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libX11], [1.6.6],
+AC_INIT([libX11], [1.6.7],
[https://gitlab.freedesktop.org/xorg/lib/libx11/issues], [libX11])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h include/X11/XlibConf.h])
=====================================
src/xcb_io.c
=====================================
@@ -230,7 +230,7 @@ static void widen(uint64_t *wide, unsigned int narrow)
* variable for that thread to process the response and wake us up.
*/
-static xcb_generic_reply_t *poll_for_event(Display *dpy)
+static xcb_generic_reply_t *poll_for_event(Display *dpy, Bool queued_only)
{
/* Make sure the Display's sequence numbers are valid */
require_socket(dpy);
@@ -238,8 +238,12 @@ static xcb_generic_reply_t *poll_for_event(Display *dpy)
/* Precondition: This thread can safely get events from XCB. */
assert(dpy->xcb->event_owner == XlibOwnsEventQueue && !dpy->xcb->event_waiter);
- if(!dpy->xcb->next_event)
- dpy->xcb->next_event = xcb_poll_for_event(dpy->xcb->connection);
+ if(!dpy->xcb->next_event) {
+ if(queued_only)
+ dpy->xcb->next_event = xcb_poll_for_queued_event(dpy->xcb->connection);
+ else
+ dpy->xcb->next_event = xcb_poll_for_event(dpy->xcb->connection);
+ }
if(dpy->xcb->next_event)
{
@@ -271,12 +275,21 @@ static xcb_generic_reply_t *poll_for_response(Display *dpy)
void *response;
xcb_generic_error_t *error;
PendingRequest *req;
- while(!(response = poll_for_event(dpy)) &&
+ while(!(response = poll_for_event(dpy, False)) &&
(req = dpy->xcb->pending_requests) &&
- !req->reply_waiter &&
- xcb_poll_for_reply64(dpy->xcb->connection, req->sequence, &response, &error))
+ !req->reply_waiter)
{
- uint64_t request = X_DPY_GET_REQUEST(dpy);
+ uint64_t request;
+
+ if(!xcb_poll_for_reply64(dpy->xcb->connection, req->sequence,
+ &response, &error)) {
+ /* xcb_poll_for_reply64 may have read events even if
+ * there is no reply. */
+ response = poll_for_event(dpy, True);
+ break;
+ }
+
+ request = X_DPY_GET_REQUEST(dpy);
if(XLIB_SEQUENCE_COMPARE(req->sequence, >, request))
{
throw_thread_fail_assert("Unknown sequence number "
@@ -617,7 +630,7 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard)
{ /* need braces around ConditionWait */
ConditionWait(dpy, dpy->xcb->event_notify);
}
- while((event = poll_for_event(dpy)))
+ while((event = poll_for_event(dpy, True)))
handle_response(dpy, event, True);
}
=====================================
src/xcms/cmsLkCol.c
=====================================
@@ -76,7 +76,8 @@ XcmsLookupColor (
register int n;
xLookupColorReply reply;
register xLookupColorReq *req;
- XColor def, scr;
+ XColor def = {0,};
+ XColor scr = {0,};
/*
* 0. Check for invalid arguments.
View it on GitLab: https://salsa.debian.org/xorg-team/lib/libx11/compare/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef...f3c978476e0be6813268af494efb7ac507451116
Commits:
d0416863 by Bhavi Dhingra at 2018-09-22T23:21:14Z
XcmsLookupColor: fully initialize XColor structs passed to _XColor_to_XcmsRGB
Fixes https://gitlab.freedesktop.org/xorg/lib/libx11/issues/44
aka https://bugs.freedesktop.org/show_bug.cgi?id=92154
Reviewed-by: Alan Coopersmith <***@oracle.com>
Signed-off-by: Alan Coopersmith <***@oracle.com>
- - - - -
406afe4b by Michel Dänzer at 2018-09-25T15:10:58Z
poll_for_response: Call poll_for_event again if xcb_poll_for_reply fails
If xcb_poll_for_reply fails to find a reply, poll_for_response would
always return NULL. However, xcb_poll_for_reply may have read events
from the display connection while looking for a reply. In that case,
returning NULL from poll_for_response is wrong and can result in the
client hanging, e.g. because it returns to waiting for the display
connection file descriptor becoming readable after XPending incorrectly
returned 0 pending events.
The solution is to call poll_for_event again after xcb_poll_for_reply
returned 0. This will return the first of any events read by
xcb_poll_for_reply.
Fixes issue #79.
Reported-by: Yuxuan Shui <***@gmail.com>
Bugzilla: https://bugs.freedesktop.org/108008
Bugzilla: https://bugs.freedesktop.org/107992
Reviewed-by: Adam Jackson <***@redhat.com>
- - - - -
823a0f8a by Michel Dänzer at 2018-09-28T15:24:17Z
poll_for_event: Allow using xcb_poll_for_queued_event
It avoids reading from the display connection again in cases where that
was already done.
Suggested-by: Uli Schlachter <***@znc.in>
Reviewed-by: Uli Schlachter <***@znc.in>
- - - - -
f3c97847 by Matt Turner at 2018-10-09T14:26:12Z
libX11 1.6.7
Signed-off-by: Matt Turner <***@gmail.com>
- - - - -
3 changed files:
- configure.ac
- src/xcb_io.c
- src/xcms/cmsLkCol.c
Changes:
=====================================
configure.ac
=====================================
@@ -1,7 +1,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libX11], [1.6.6],
+AC_INIT([libX11], [1.6.7],
[https://gitlab.freedesktop.org/xorg/lib/libx11/issues], [libX11])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([src/config.h include/X11/XlibConf.h])
=====================================
src/xcb_io.c
=====================================
@@ -230,7 +230,7 @@ static void widen(uint64_t *wide, unsigned int narrow)
* variable for that thread to process the response and wake us up.
*/
-static xcb_generic_reply_t *poll_for_event(Display *dpy)
+static xcb_generic_reply_t *poll_for_event(Display *dpy, Bool queued_only)
{
/* Make sure the Display's sequence numbers are valid */
require_socket(dpy);
@@ -238,8 +238,12 @@ static xcb_generic_reply_t *poll_for_event(Display *dpy)
/* Precondition: This thread can safely get events from XCB. */
assert(dpy->xcb->event_owner == XlibOwnsEventQueue && !dpy->xcb->event_waiter);
- if(!dpy->xcb->next_event)
- dpy->xcb->next_event = xcb_poll_for_event(dpy->xcb->connection);
+ if(!dpy->xcb->next_event) {
+ if(queued_only)
+ dpy->xcb->next_event = xcb_poll_for_queued_event(dpy->xcb->connection);
+ else
+ dpy->xcb->next_event = xcb_poll_for_event(dpy->xcb->connection);
+ }
if(dpy->xcb->next_event)
{
@@ -271,12 +275,21 @@ static xcb_generic_reply_t *poll_for_response(Display *dpy)
void *response;
xcb_generic_error_t *error;
PendingRequest *req;
- while(!(response = poll_for_event(dpy)) &&
+ while(!(response = poll_for_event(dpy, False)) &&
(req = dpy->xcb->pending_requests) &&
- !req->reply_waiter &&
- xcb_poll_for_reply64(dpy->xcb->connection, req->sequence, &response, &error))
+ !req->reply_waiter)
{
- uint64_t request = X_DPY_GET_REQUEST(dpy);
+ uint64_t request;
+
+ if(!xcb_poll_for_reply64(dpy->xcb->connection, req->sequence,
+ &response, &error)) {
+ /* xcb_poll_for_reply64 may have read events even if
+ * there is no reply. */
+ response = poll_for_event(dpy, True);
+ break;
+ }
+
+ request = X_DPY_GET_REQUEST(dpy);
if(XLIB_SEQUENCE_COMPARE(req->sequence, >, request))
{
throw_thread_fail_assert("Unknown sequence number "
@@ -617,7 +630,7 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard)
{ /* need braces around ConditionWait */
ConditionWait(dpy, dpy->xcb->event_notify);
}
- while((event = poll_for_event(dpy)))
+ while((event = poll_for_event(dpy, True)))
handle_response(dpy, event, True);
}
=====================================
src/xcms/cmsLkCol.c
=====================================
@@ -76,7 +76,8 @@ XcmsLookupColor (
register int n;
xLookupColorReply reply;
register xLookupColorReq *req;
- XColor def, scr;
+ XColor def = {0,};
+ XColor scr = {0,};
/*
* 0. Check for invalid arguments.
View it on GitLab: https://salsa.debian.org/xorg-team/lib/libx11/compare/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef...f3c978476e0be6813268af494efb7ac507451116
--
View it on GitLab: https://salsa.debian.org/xorg-team/lib/libx11/compare/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef...f3c978476e0be6813268af494efb7ac507451116
You're receiving this email because of your account on salsa.debian.org.
View it on GitLab: https://salsa.debian.org/xorg-team/lib/libx11/compare/733f64bfeb311c1d040b2f751bfdef9c9d0f89ef...f3c978476e0be6813268af494efb7ac507451116
You're receiving this email because of your account on salsa.debian.org.