| 1 |
// I noticed this on the ConEmu web site: |
| 2 |
// |
| 3 |
// https://social.msdn.microsoft.com/Forums/en-US/40c8e395-cca9-45c8-b9b8-2fbe6782ac2b/readconsoleoutput-cause-access-violation-writing-location-exception |
| 4 |
// https://conemu.github.io/en/MicrosoftBugs.html |
| 5 |
// |
| 6 |
// In Windows 7, 8, and 8.1, a ReadConsoleOutputW with an out-of-bounds read |
| 7 |
// region crashes the application. I have reproduced the problem on Windows 8 |
| 8 |
// and 8.1, but not on Windows 7. |
| 9 |
// |
| 10 |
|
| 11 |
#include <windows.h> |
| 12 |
|
| 13 |
#include "TestUtil.cc" |
| 14 |
|
| 15 |
int main() { |
| 16 |
setWindowPos(0, 0, 1, 1); |
| 17 |
setBufferSize(80, 25); |
| 18 |
setWindowPos(0, 0, 80, 25); |
| 19 |
|
| 20 |
const HANDLE conout = openConout(); |
| 21 |
static CHAR_INFO lineBuf[80]; |
| 22 |
SMALL_RECT readRegion = { 0, 999, 79, 999 }; |
| 23 |
const BOOL ret = ReadConsoleOutputW(conout, lineBuf, {80, 1}, {0, 0}, &readRegion); |
| 24 |
ASSERT(!ret && "ReadConsoleOutputW should have failed"); |
| 25 |
|
| 26 |
return 0; |
| 27 |
} |