Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Stack overflow crash due to stack-allocation in loop condition

Open disarray2077 opened this issue 2 years ago • 0 comments

The code below is causing a stack overflow crash, it appears that the delegate allocated in the loop condition is being unnecessarily kept on the stack during all loop interactions.

List<int> TestList = scope .();

while (TestList.FindIndex(scope (i) => i > 100000) == -1)
{
	TestList.Add(TestList.Count);
}

Tested with: https://github.com/beefytech/Beef/commit/4c656529556ef2e7f8398be1b6c1d803dea512a6

disarray2077 avatar May 16 '23 23:05 disarray2077