From 9cef096b83c6439b9d468a76d74c088f29602e46 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 17 Aug 2003 05:46:52 +0000 Subject: Added assertion to prevent retrieving text beyond the end of the document. --- src/Editor.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index 8544ee756..1376787fa 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5311,6 +5311,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { int cpMax = tr->chrg.cpMax; if (cpMax == -1) cpMax = pdoc->Length(); + PLATFORM_ASSERT(cpMax <= pdoc->Length()); int len = cpMax - tr->chrg.cpMin; // No -1 as cpMin and cpMax are referring to inter character positions pdoc->GetCharRange(tr->lpstrText, tr->chrg.cpMin, len); // Spec says copied text is terminated with a NUL -- cgit v1.2.3