Skip to content

Commit

Permalink
Maximus5gh-1149: Fix crash in wide consoles, when the cursor goes ove…
Browse files Browse the repository at this point in the history
…r 200 col (f8907a1 regression).
  • Loading branch information
ajax16384 authored and michaellukashov committed Jun 19, 2017
1 parent 6e96687 commit 1f2545d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ConEmuCD/ConsoleMain.cpp
Expand Up @@ -5704,13 +5704,13 @@ void static CorrectDBCSCursorPosition(HANDLE ahConOut, CONSOLE_SCREEN_BUFFER_INF
{
// Temporary workaround for conhost bug!
CHAR_INFO CharsEx[200];
CHAR_INFO* pCharsEx = (csbi.dwCursorPosition.X <= cchMax) ? CharsEx
: (CHAR_INFO*)calloc(csbi.dwCursorPosition.X, sizeof(*pCharsEx));
CHAR_INFO* pCharsEx = (cchMax <= countof(CharsEx)) ? CharsEx
: (CHAR_INFO*)calloc(cchMax, sizeof(*pCharsEx));
if (pCharsEx)
{
COORD bufSize = {cchMax, 1}; COORD bufCoord = {0,0};
SMALL_RECT rgn = MakeSmallRect(0, csbi.dwCursorPosition.Y, cchMax-1, csbi.dwCursorPosition.Y);
bRead = ReadConsoleOutputW(ahConOut, CharsEx, bufSize, bufCoord, &rgn);
bRead = ReadConsoleOutputW(ahConOut, pCharsEx, bufSize, bufCoord, &rgn);
if (bRead)
{
int nXShift = 0;
Expand Down

0 comments on commit 1f2545d

Please sign in to comment.