Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Far screen selection unexpectedly close wide console #1149

Closed
ajax16384 opened this issue May 24, 2017 · 9 comments
Closed

Far screen selection unexpectedly close wide console #1149

ajax16384 opened this issue May 24, 2017 · 9 comments

Comments

@ajax16384
Copy link
Contributor

@ajax16384 ajax16384 commented May 24, 2017

Versions

ConEmu build: 170517 x64
OS version: Windows 10 x64
Used shell version (Far Manager, git-bash, cmd, powershell, cygwin, whatever): Far 4949

Problem description

during Far screen selection ConEmu unexpectedly close wide console (>253 char length)

Steps to reproduce

  1. start Far task
  2. make ConEmu console width size > 253 (e.g. 260x30)
  3. press Alt-Ins (Far starts screen selection)
  4. press Shift-End

Actual results

ConEmu close console

Expected results

Far selection carret should reach end of console screen

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented May 24, 2017

It looks like a Far crash! ConEmu never closes consoles without any reason.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented May 24, 2017

@ajax16384
Copy link
Contributor Author

@ajax16384 ajax16384 commented May 24, 2017

Unable to repro with vanilla Far (launched without ConEmu).

@ajax16384
Copy link
Contributor Author

@ajax16384 ajax16384 commented May 24, 2017

attached to Far under ConEmu and repro:
Unhandled exception at 0x000000006F7CFFC4 (ConEmuCD64.dll) in Far.exe: Stack cookie instrumentation code detected a stack-based buffer overrun.

>	ConEmuCD64.dll!000000006f7cffc4()	Unknown
 	ConEmuCD64.dll!000000006f7b6ffb()	Unknown
 	ConEmuCD64.dll!000000006f7b742d()	Unknown
 	ConEmuCD64.dll!000000006f7a5376()	Unknown
 	ConEmuCD64.dll!000000006f7a5ed8()	Unknown
 	ConEmuCD64.dll!000000006f7a70c8()	Unknown
 	ConEmuCD64.dll!000000006f791f38()	Unknown
 	[External Code]	
ConEmuCD64.dll	17.05.17.0	17.05.2017 23:56	000000006F780000-000000006F839000

(unfortunately release .7z contains .map only for main image. I would be nice to include .map|.pdb for rest .dlls)

@ajax16384
Copy link
Contributor Author

@ajax16384 ajax16384 commented May 24, 2017

git local build:

Exception thrown: read access violation.

p was 0xFFFFFFFFFFFFFFFF.

>	ConEmuCD64.dll!CorrectDBCSCursorPosition(void * ahConOut, _CONSOLE_SCREEN_BUFFER_INFO & csbi) Line 5720	C++
 	[External Code]	
 	ConEmuCD64.dll!ReadConsoleInfo() Line 3933	C++
 	ConEmuCD64.dll!ReloadFullConsoleInfo(int abForceSend) Line 4357	C++
 	ConEmuCD64.dll!RefreshThread(void * lpvParam) Line 5130	C++
 	ConEmuCD64.dll!apiThreadHelper(void * lpParameter) Line 128	C++
@ajax16384
Copy link
Contributor Author

@ajax16384 ajax16384 commented May 24, 2017

bug is here:

CHAR Chars[200];
LONG cchMax = countof(Chars);
LPSTR pChars = (csbi.dwCursorPosition.X <= cchMax) ? Chars : (LPSTR)calloc(csbi.dwCursorPosition.X, sizeof(*pChars));
if (pChars)
	cchMax = csbi.dwCursorPosition.X; // !!!! modifies cchMax so it contains > countof(Chars)
else
	pChars = Chars; // memory allocation fail? try part of line?
....
CHAR_INFO CharsEx[200];
CHAR_INFO* pCharsEx = (csbi.dwCursorPosition.X <= cchMax) ? CharsEx /// !!!! 
// now cchMax greater than 200 but trying to use stack storage "CharsEx" with overrun
	: (CHAR_INFO*)calloc(csbi.dwCursorPosition.X, sizeof(*pCharsEx));

cchMax should be recalculated after CharsEx declaration or instead of "200" const-define must be used

@ajax16384
Copy link
Contributor Author

@ajax16384 ajax16384 commented May 24, 2017

should I make PR?

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented May 24, 2017

Appreciated. Sort of

... = (cchMax <= countof(CharsEx)) ? ...
ajax16384 added a commit to ajax16384/ConEmu that referenced this issue May 24, 2017
@ajax16384
Copy link
Contributor Author

@ajax16384 ajax16384 commented May 27, 2017

it's ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.