From 3302162edea3ac0b88983c22ded9fb4c495c2b98 Mon Sep 17 00:00:00 2001 From: DONGGEUN YOO <59035549+bleeqer@users.noreply.github.com> Date: Sat, 25 Oct 2025 10:41:58 -0400 Subject: [PATCH] Fix uninitialized length in X11_GetClipboardData causing test failures (#14322) (cherry picked from commit 093fbfd867a574359ea0d987adb78cdda935688c) --- src/video/x11/SDL_x11clipboard.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c index 6a4a1cec5b..a57f98eb22 100644 --- a/src/video/x11/SDL_x11clipboard.c +++ b/src/video/x11/SDL_x11clipboard.c @@ -273,6 +273,9 @@ bool X11_SetClipboardData(SDL_VideoDevice *_this) void *X11_GetClipboardData(SDL_VideoDevice *_this, const char *mime_type, size_t *length) { SDL_VideoData *videodata = _this->internal; + + *length = 0; + if (!SDL_HasInternalClipboardData(_this, mime_type)) { // This mime type wasn't advertised by the last selection owner. // The atom might still have data, but it's stale, so ignore it.