From 8af772a883bc30453eeba29b76423dea5d0bb357 Mon Sep 17 00:00:00 2001
From: Du Yijie <[EMAIL REDACTED]>
Date: Wed, 26 Nov 2025 23:01:48 +0800
Subject: [PATCH] Fix memcpy misuse in TTF_DeleteTextString
AddressSanitizer aborts the program when calling TTF_DeleteTextString,
which in turn calls SDL_memcpy instead of the correct SDL_memmove.
This commit fixes the abort under ASan.
---
src/SDL_ttf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index 54ce8ccb..e7576f1d 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -5065,7 +5065,7 @@ bool TTF_DeleteTextString(TTF_Text *text, int offset, int length)
text->text[offset] = '\0';
} else {
int shift = (old_length - length - offset);
- SDL_memcpy(&text->text[offset], &text->text[offset + length], shift);
+ SDL_memmove(&text->text[offset], &text->text[offset + length], shift);
text->text[offset + shift] = '\0';
}