Skip to content

Fix CopyPasteSendText using character count instead of byte count - #802

Open
pwn2ooown wants to merge 1 commit into
vmware:masterfrom
pwn2ooown:fix/copypaste-size-to-bytes
Open

Fix CopyPasteSendText using character count instead of byte count#802
pwn2ooown wants to merge 1 commit into
vmware:masterfrom
pwn2ooown:fix/copypaste-size-to-bytes

Conversation

@pwn2ooown

Copy link
Copy Markdown

Summary

CopyPasteUIX11::CopyPasteSendText() in copyPasteUIX11GTK4.cpp uses Glib::ustring::size() as a byte length, but size() returns the character count, not the byte count. This causes multi-byte text (e.g. CJK characters) to be truncated when passed to CPClipboard_SetItem, which expects a byte length.

Fix: Replace cpStr.size() with cpStr.bytes() to get the correct byte count.

Fixes #800

Glib::ustring::size() returns the number of UTF-8 characters, not
bytes. This causes multi-byte text (e.g. CJK characters) to be
truncated when passed to CPClipboard_SetItem, which expects a byte
length. Use bytes() to get the correct byte count.

Fixes vmware#800
@legal-compliance-bot

Copy link
Copy Markdown

🛑 Legal Compliance Check Failed

Hi @pwn2ooown, thank you for your contribution!

To merge this Pull Request, you must sign our CLA.

Note: Even if you signed off your commits locally (using git commit -s), you must post the comment below to register your signature with our automated system.
Note: This is a one-time process. Once signed, future contributions to this repository will be verified automatically.

1. Read the Document: Click here to read the CLA
2. Sign via Comment: Copy and paste the exact line below into a new comment on this Pull Request:

I have read the CLA Document and I hereby sign the CLA for this and all future contributions.

⏳ Processing Schedule:
Our 'Compliance Sweeper' runs automatically approximately every 15-20 minutes.
After you post the comment, your status will update automatically during the next scheduled run.
You do not need to take any further action.

@pwn2ooown

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA for this and all future contributions.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guest-to-host clipboard fails for any non-ASCII text (dndcp GTK4: size() used as byte length)

1 participant