GNOME Bugzilla – Bug 775394
Cursor hotspot outside pixbuf size causes a X Window System error
Last modified: 2017-02-14 09:24:52 UTC
Created attachment 341038 [details] VNC Client A simple Python2 VNC client (Gtk2) script connects a VNC server sending a dummy cursor (hotx=5, hoty=10, width=1 and height=1). It produces a warning but does not crash and the application is fully working a excepted. Warning: ./vncviewer.py:11: GtkWarning: IA__gdk_cursor_new_from_pixbuf: assertion '0 <= x && x < gdk_pixbuf_get_width (pixbuf)' failed gtk.main() ---------------- The same script ported to Python3 (Gtk3) don't produce any warning as excepted but crash and is unusable. Error: (vncviewer.py3:1487): Gdk-ERROR **: The program 'vncviewer.py3' received an X Window System error. This probably reflects a bug in the program. The error was 'BadMatch (invalid parameter attributes)'. (Details: serial 276 error_code 8 request_code 139 (RENDER) minor_code 27) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the GDK_SYNCHRONIZE environment variable to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.)
+ Trace 236906
---------------- This patch fix the problem: diff --git a/src/vnccursor.c b/src/vnccursor.c index 4dd188f..5cc343b 100644 --- a/src/vnccursor.c +++ b/src/vnccursor.c @@ -143,6 +143,9 @@ VncCursor *vnc_cursor_new(guint8 *data, guint16 hotx, guint16 hoty, guint16 width, guint16 height) { + /* Clamp hotx and hoty */ + if(hotx > width) hotx = width; + if(hoty > height) hoty = height; return VNC_CURSOR(g_object_new(VNC_TYPE_CURSOR, "data", data, "hotx", hotx, This is probably a faulty behaviour of the VNC Server (Red Hat 3 Update 9 Xvnc 4.0b4). But I think this error should be catch at least in the GtkVnc lib (To be able to connects all VNC Server). Thanks you.
I pushed an equivalent fix that does the clamping sooner where we process the data off the wire, instead of in the cursor object. commit 65e2d1cd25dc9a339d75b9ad723d28df51437aab Author: Daniel P. Berrange <berrange@redhat.com> Date: Wed Feb 8 12:43:27 2017 +0000 Clamp cursor hot-pixel to be within cursor region Some broken VNC servers send hot-pixel outside bounds of the cursor. We could disconnect and report an error, but it is more user friendly to just clamp the hot pixel coords https://bugzilla.gnome.org/show_bug.cgi?id=775394 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Fixed in 0.7.0 release