Skip to content

libvncserver: limit cursor redraw to requested region#714

Open
marcofortina wants to merge 1 commit into
LibVNC:masterfrom
marcofortina:fix/cursor-redraw-requested-region
Open

libvncserver: limit cursor redraw to requested region#714
marcofortina wants to merge 1 commit into
LibVNC:masterfrom
marcofortina:fix/cursor-redraw-requested-region

Conversation

@marcofortina
Copy link
Copy Markdown
Contributor

@marcofortina marcofortina commented May 16, 2026

Summary

Fixes cursor redraw regions being included in a framebuffer update even when the client did not request that area.

When a client does not use cursor shape updates, LibVNCServer draws the cursor into the framebuffer and later redraws the old/new cursor rectangles after hiding or moving it. During rfbSendFramebufferUpdate(), those cursor rectangles were OR'ed into updateRegion after the normal requestedRegion intersection, so they could be sent even when the client's requested rectangle was empty or unrelated.

Changes

  • Preserve a snapshot of the client's requested region while preparing a framebuffer update.
  • Limit cursor-redraw rectangles to that requested region before adding them to the outgoing update region.
  • Keep the existing behavior for paths that redraw the cursor into the modified region outside an immediate framebuffer update.
  • Add a regression test for empty and partial requested-region cursor redraw cases.

Validation

cmake -S . -B build-586-patch \
  -DWITH_EXAMPLES=OFF \
  -DWITH_TESTS=ON \
  -DWITH_OPENSSL=OFF \
  -DWITH_GNUTLS=OFF \
  -DWITH_GCRYPT=OFF \
  -DWITH_SDL=OFF \
  -DWITH_GTK=OFF \
  -DWITH_QT=OFF \
  -DWITH_FFMPEG=OFF \
  -DWITH_XCB=OFF \
  -DWITH_LIBSSHTUNNEL=OFF \
  -DWITH_SYSTEMD=OFF \
  -DCMAKE_BUILD_TYPE=Debug
cmake --build build-586-patch --parallel 1
ctest --test-dir build-586-patch --output-on-failure

Result:

100% tests passed, 0 tests failed out of 6

Notes

Closes #586.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Framebuffer update of cursor-modified regions are sent even if client did not request them

2 participants