From 0f36ec9cb9c8a9ac192a2571f6dd9bfc9000b514 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 4 Jun 2016 14:48:08 +0100 Subject: [PATCH] Fixed a crash bug in stb_textedit.h (#681) --- stb_textedit.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stb_textedit.h b/stb_textedit.h index 3c3003252..23f0f24ee 100644 --- a/stb_textedit.h +++ b/stb_textedit.h @@ -1,4 +1,5 @@ // [ImGui] this is a slightly modified version of stb_truetype.h 1.8 +// [ImGui] - fixed a crash bug in stb_textedit_discard_redo (#681) // [ImGui] - fixed some minor warnings // [ImGui] - added STB_TEXTEDIT_MOVEWORDLEFT/STB_TEXTEDIT_MOVEWORDRIGHT custom handler (#473) @@ -1095,7 +1096,7 @@ static void stb_textedit_discard_redo(StbUndoState *state) int n = state->undo_rec[k].insert_length, i; // delete n characters from all other records state->redo_char_point = state->redo_char_point + (short) n; // vsnet05 - STB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, (size_t) ((size_t)(STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_char_point)*sizeof(STB_TEXTEDIT_CHARTYPE))); + STB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, (size_t) ((size_t)(STB_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point)*sizeof(STB_TEXTEDIT_CHARTYPE))); for (i=state->redo_point; i < k; ++i) if (state->undo_rec[i].char_storage >= 0) state->undo_rec[i].char_storage = state->undo_rec[i].char_storage + (short) n; // vsnet05