Skip to content

wayland: guard null clipboard offer - #16256

Open
brahmkshatriya wants to merge 1 commit into
libsdl-org:mainfrom
brahmkshatriya:main
Open

wayland: guard null clipboard offer#16256
brahmkshatriya wants to merge 1 commit into
libsdl-org:mainfrom
brahmkshatriya:main

Conversation

@brahmkshatriya

@brahmkshatriya brahmkshatriya commented Sep 6, 2026

Copy link
Copy Markdown
  • I confirm that I am the author of this code and release it to the SDL project under the zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Description

The Wayland selection callback can invoke Wayland_DataOfferNotifyFromMIMEs(NULL, ...) when the compositor clears the clipboard selection. The function already handles a null offer while collecting MIME types, but subsequently passed that null pointer unconditionally to SetCurrentClipboardOffer(), which dereferences it.

This caused a reproducible segmentation fault in the Wayland event pump:

Wayland_DataOfferNotifyFromMIMEs
libffi
libwayland-client
Wayland_PumpEvents
SDL_WaitEventTimeoutNS

Existing Issue(s)

No existing issue found for this specific null dereference.

@Kontrabant

Copy link
Copy Markdown
Contributor

Hmm, this fixes the issue on the surface, but there's still state that should be updated, even with a nil offer, that this would prevent. I think I have a better way to handle this.

@brahmkshatriya

Copy link
Copy Markdown
Author

Oh? what would that be? to update the clipboard state using the data device/seat even when the offer is nil?

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