Skip to content

Prevent clipboard crash when mime type is missing.#154

Merged
JSUYA merged 3 commits intoflutter-tizen:masterfrom
JSUYA:prevent_clipboard_crash
Feb 12, 2026
Merged

Prevent clipboard crash when mime type is missing.#154
JSUYA merged 3 commits intoflutter-tizen:masterfrom
JSUYA:prevent_clipboard_crash

Conversation

@JSUYA
Copy link
Member

@JSUYA JSUYA commented Feb 11, 2026

While testing the clipboard, I noticed that when I copied text, event's mime type was empty.
So, I confirmed that a crash occurred when I tried to paste without copying data to the event's fd.
To prevent this crash, I changed result_ptr to unique_ptr.
Also, to avoid sending an error result twice, GetData() does not call on_data_callback_.
(An error result is sent by returning false.)

@JSUYA JSUYA self-assigned this Feb 11, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates clipboard handling. In platform_channel.cc, raw pointer management for MethodResult is replaced with std::shared_ptr for asynchronous callbacks. In tizen_clipboard.cc, a call to on_data_callback_ is removed to prevent sending duplicate errors, the mime type check in SendData is updated to allow empty strings, and on_data_callback_ is nullified in the destructor. However, it introduces a new potential crash in the logging logic when a mime type is missing. Specifically, streaming a NULL pointer to the log stream is undefined behavior and can lead to a Denial of Service. This should be addressed by safely handling the NULL pointer during logging.

I'm not sure exactly when an event is triggered with an empty type. However, even when copying plain text, the type can sometimes be empty. Therefore, if the type of the Ecore_Wl2_Event_Data_Source_Send event is empty, it is considered "text/plain."
@JSUYA JSUYA force-pushed the prevent_clipboard_crash branch from 871bfd2 to b9661ab Compare February 12, 2026 07:40
@JSUYA JSUYA merged commit 2060d31 into flutter-tizen:master Feb 12, 2026
10 checks passed
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.

2 participants