** Description changed:

- After the freerdp3 security update from 3.32.1+dfsg-0ubuntu0.26.04.1 to
- 3.32.2+dfsg-0ubuntu0.26.04.1, WinPR can no longer convert HTML clipboard
- data. ClipboardGetData() returns NULL for "HTML Format" -> "text/html"
- and for "text/html" -> "HTML Format".
+ [Impact]
  
- I noticed it with gnome-remote-desktop on Ubuntu 26.04 (Remote Login,
- Windows mstsc client). When I copied formatted text on Windows and
- pasted it into an Electron app on Ubuntu, the paste hung for about 15
- seconds and gnome-remote-desktop logged:
+ After the freerdp3 3.32.2 security update (3.32.2+dfsg-0ubuntu0.24.04.1 in
+ noble, 3.32.2+dfsg-0ubuntu0.26.04.1 in resolute, 3.32.2+dfsg-0ubuntu0.26.10.1
+ in stonking), WinPR can no longer convert HTML clipboard data in either
+ direction. ClipboardGetData() always returns NULL for both
+ "HTML Format" -> "text/html" and "text/html" -> "HTML Format".
  
- [RDP.CLIPRDR] Converting clipboard content failed: Failed to get
+ For users of gnome-remote-desktop (and other FreeRDP/WinPR consumers),
+ copying formatted HTML text from a Windows RDP client and pasting it into a
+ Linux application (such as Electron apps or browsers) fails with:
+ 
+   [RDP.CLIPRDR] Converting clipboard content failed: Failed to get
  converted data
  
- The 15 second wait itself comes from mutter, which I reported
- separately: https://gitlab.gnome.org/GNOME/mutter/-/issues/5199
+ and causes a ~15 second paste hang in mutter.
  
- 3.32.2 includes upstream commit 2ecbfaf1f1f7 ("[winpr,clipboard] Add
- ClipboardRegisterSynthesizerEx"). The new API passes the destination
- format to clipboard_synthesize_html_format() and
- clipboard_synthesize_ms_html_format()
- (winpr/libwinpr/clipboard/synthetic.c), but their inner checks still
- compare it with the source format, so the conversion is always skipped.
- Upstream fixed this in commit ffdee9b6c2d3
- (https://github.com/FreeRDP/FreeRDP/pull/13734), a two-line change that
- is in 3.33.0.
+ Root cause: FreeRDP 3.32.2 included upstream commit 2ecbfaf1f1f7
+ ("[winpr,clipboard] Add ClipboardRegisterSynthesizerEx"), which changed
+ clipboard_synthesize_ms_html_format() and clipboard_synthesize_html_format()
+ in winpr/libwinpr/clipboard/synthetic.c to receive the destination format ID,
+ while their inner if-checks still compared against the source format ID.
  
- The attached html.c shows it. Build with: gcc -o html html.c 
/usr/lib/x86_64-linux-gnu/libwinpr3.so.3
- Output with libwinpr3-3 3.32.2+dfsg-0ubuntu0.26.04.1:
+ This upload cherry-picks upstream commit 
ffdee9b6c2d3a3ec6e5737d9c2194c25a329bf88
+ (https://github.com/FreeRDP/FreeRDP/pull/13734, released in 3.33.0), which
+ swaps those two inner checks to compare against the destination format ID.
  
- HTML Format -> text/html: NULL
- text/html -> HTML Format: NULL
+ [Test Plan]
  
- I rebuilt libwinpr3 from the 3.32.2+dfsg-0ubuntu0.26.04.1 source with
- ffdee9b applied, and both conversions work.
+ 1. Install gcc and libwinpr3-3 (and ensure the current 3.32.2+dfsg-0ubuntu0.*
+    package is installed).
+ 2. Download the attached html.c reproducer from this bug and compile it:
  
- noble and stonking got the same 3.32.2, but I only tested resolute.
+    gcc -o html html.c /usr/lib/x86_64-linux-gnu/libwinpr3.so.3
  
- Could ffdee9b be included in the next freerdp3 update?
+ 3. Run ./html before upgrading and verify it reproduces the bug:
+ 
+    HTML Format -> text/html: NULL
+    text/html -> HTML Format: NULL
+ 
+ 4. Upgrade libwinpr3-3 (and freerdp3 binary packages) from <series>-proposed
+    to 3.32.2+dfsg-0ubuntu0.<ver>.2.
+ 5. Re-run ./html and verify both directions succeed and output valid HTML:
+ 
+    HTML Format -> text/html: OK
+      
<html><body><!--StartFragment--><b>hello</b><!--EndFragment--></body></html>
+    text/html -> HTML Format: OK
+      Version:0.9
+    StartHTML:0000000105
+    EndHTML:0000000181
+    StartFragment:0000000137
+    EndFragment:0000000149
+    
<HTML><BODY><!--StartFragment--><b>hello</b><!--EndFragment--></BODY></HTML>
+ 
+ 6. (Optional E2E check) Connect to gnome-remote-desktop from a Windows RDP
+    client (mstsc), copy formatted text from Windows and paste into a Linux
+    application requesting text/html, and vice versa. Confirm paste succeeds
+    immediately without "[RDP.CLIPRDR] Converting clipboard content failed" in
+    the gnome-remote-desktop journal.
+ 
+ [Where problems could occur]
+ 
+ The patch modifies only the two format-ID guards inside
+ clipboard_synthesize_ms_html_format() and clipboard_synthesize_html_format()
+ in winpr/libwinpr/clipboard/synthetic.c (shipped in libwinpr3-3).
+ 
+ If HTML clipboard synthesis itself contains latent bugs that were previously
+ masked by the functions returning NULL, they would now be exercised when
+ pasting HTML content across RDP sessions (in gnome-remote-desktop, xfreerdp,
+ wlfreerdp, or sdl-freerdp). A regression would manifest as malformed or
+ truncated HTML on paste, incorrect StartHTML/EndHTML/StartFragment/EndFragment
+ offsets sent to Windows clients, or a crash in libwinpr3-3 when converting
+ unusual or untrusted HTML clipboard payloads. Non-HTML clipboard formats
+ (plain text, images, files) are untouched.
+ 
+ [Other Info]
+ 
+ - Upstream fix: https://github.com/FreeRDP/FreeRDP/pull/13734
+   (commit ffdee9b6c2d3a3ec6e5737d9c2194c25a329bf88, in FreeRDP 3.33.0).
+ - In tenacious (devel), freerdp3 3.33.1+dfsg-3 is in tenacious-proposed
+   (contains ffdee9b6c2d3) and is migrating once the truncated
+   gnome-remote-desktop autopkgtest runs on amd64/armhf are retried.
+ - All three supported stable series carrying 3.32.2 (noble, resolute,
+   stonking) receive the same two-line patch.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173827

Title:
  3.32.2 regression: WinPR HTML clipboard conversion always fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/freerdp3/+bug/2173827/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to