gtest is handling _chkstk improperly.
- Dominant language
- C++
- Stars
- 39.5k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
_chkstk will probe the stack pages for the given size and eventually allocates more space if it exceeds 4k (32 bit) or 8k (64 bit). This is done by exceptions and gtest seems to swallow them rather than passing them over so you will end up having test failures.
```
constexpr size_t BufferLength = 1024 * 1024 * 10;
TEST(ChkstkFail, all)
{
uint8_t StackData[BufferLength];
StackData[BufferLength - 1] = 0xFF;
ASSERT_EQ(StackData[BufferLength - 1], 0xFF);
SUCCEED();
}
```
The above snippet will throw following exception.
```
Exception thrown at 0x00007FF6DFBBBC18 in tests.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000093E4803000).
```
The given snippet will function normally when not using the gtest environment.
Contributor guide
Research direction
Start with the ChkstkFail test snippet in the issue and reproduce it on the reported Windows configuration, comparing behavior inside and outside the GoogleTest environment. Trace how the test runner handles the _chkstk stack-overflow exception; done means the exception is no longer incorrectly swallowed and the test behaves as it does without gtest.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100