[gtk-vnc] src: block non-incremental updates after extended desktop resize



commit faacea8b016ea6af2a25610c0fb76e71c45a5c9d
Author: Daniel P. Berrangé <dan berrange com>
Date:   Tue Dec 8 18:16:08 2020 +0000

    src: block non-incremental updates after extended desktop resize
    
    A compliant server must send a extended desktop resize framebuffer
    update after receiving an update reqest with incremental==0. This will
    trigger an infinite loop if the client responds to a desktop resize
    with incremental==0.
    
    Block the next framebuffer update request from using incremental==0
    if it immediately follows a extended desktop resize.
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 src/vncconnection.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 87cbf2e..3ee2b05 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -250,6 +250,7 @@ struct _VncConnectionPrivate
         guint16 width;
         guint16 height;
     } lastUpdateRequest;
+    gboolean skip_non_incremental;
 
     gboolean has_audio;
     gboolean audio_format_pending;
@@ -1900,6 +1901,11 @@ gboolean vnc_connection_framebuffer_update_request(VncConnection *conn,
     VNC_DEBUG("Requesting framebuffer update at %d,%d size %dx%d, incremental %d",
               x, y, width, height, (int)incremental);
 
+    if (!incremental && priv->skip_non_incremental) {
+        VNC_DEBUG("Blocking non-incremental update request after extended desktop resize");
+        incremental = TRUE;
+    }
+    priv->skip_non_incremental = FALSE;
     priv->lastUpdateRequest.incremental = incremental;
     priv->lastUpdateRequest.x = x;
     priv->lastUpdateRequest.y = y;
@@ -2975,6 +2981,15 @@ static void vnc_connection_extended_resize(VncConnection *conn, int width, int h
     if (vnc_connection_has_error(conn))
         return;
 
+    /* Traditionally clients would send a non-incremental update
+     * in response to a desktop resize. The VNC server must
+     * always send an immediate extended desktop resize framebuffer
+     * update in response to non-incremental update request. This
+     * would trigger an infinite loop, so we must block a request
+     * for a non-incremental update immediately following this
+     * resize
+     */
+    priv->skip_non_incremental = TRUE;
     priv->width = width;
     priv->height = height;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]