Skip to content

Commit 3d08ecf

Browse files
mcenduslouken
authored andcommitted
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. (cherry picked from commit 8af772a)
1 parent 592b2ce commit 3d08ecf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SDL_ttf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5073,7 +5073,7 @@ bool TTF_DeleteTextString(TTF_Text *text, int offset, int length)
50735073
text->text[offset] = '\0';
50745074
} else {
50755075
int shift = (old_length - length - offset);
5076-
SDL_memcpy(&text->text[offset], &text->text[offset + length], shift);
5076+
SDL_memmove(&text->text[offset], &text->text[offset + length], shift);
50775077
text->text[offset + shift] = '\0';
50785078
}
50795079

0 commit comments

Comments
 (0)