After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775394 - Cursor hotspot outside pixbuf size causes a X Window System error
Cursor hotspot outside pixbuf size causes a X Window System error
Status: RESOLVED FIXED
Product: gtk-vnc
Classification: Other
Component: general
0.5.x
Other Linux
: Normal major
: ---
Assigned To: gtk-vnc-maint
gtk-vnc-maint
Depends on:
Blocks:
 
 
Reported: 2016-11-30 12:47 UTC by alcantor
Modified: 2017-02-14 09:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
VNC Client (616 bytes, text/plain)
2016-11-30 12:47 UTC, alcantor
Details

Description alcantor 2016-11-30 12:47:03 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.)

  • #0 g_logv
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #1 g_log
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #2 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #3 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #4 _XError
    from /usr/lib/x86_64-linux-gnu/libX11.so.6
  • #5 ??
    from /usr/lib/x86_64-linux-gnu/libX11.so.6
  • #6 ??
    from /usr/lib/x86_64-linux-gnu/libX11.so.6
  • #7 _XEventsQueued
    from /usr/lib/x86_64-linux-gnu/libX11.so.6
  • #8 XPending
    from /usr/lib/x86_64-linux-gnu/libX11.so.6
  • #9 ??
    from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
  • #10 g_main_context_prepare
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #11 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #12 g_main_loop_run
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #13 gtk_main
    from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
  • #14 ffi_call_unix64
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #15 ffi_call
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #16 ??
    from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
  • #17 ??
    from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
  • #18 PyObject_Call
  • #19 PyEval_EvalFrameEx
  • #20 ??
  • #21 PyEval_EvalCode
  • #22 ??
  • #23 PyRun_FileExFlags
  • #24 PyRun_SimpleFileExFlags
  • #25 Py_Main
  • #26 main

----------------

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.
Comment 1 Daniel P. Berrange 2017-02-08 12:50:07 UTC
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>
Comment 2 Daniel P. Berrange 2017-02-14 09:24:52 UTC
Fixed in 0.7.0 release