-
Notifications
You must be signed in to change notification settings - Fork 5k
Fix DeepEquals_DeepJsonDocument stack overflow that manifests in xunit.console and netfx. #105309
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
Fix DeepEquals_DeepJsonDocument stack overflow that manifests in xunit.console and netfx. #105309
Conversation
…t.console and netfx.
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
Where was the stack overflow occurring? |
The |
I'd asked about stack overflows here: |
That's still the case, however if you configure the max permitted depth to be something ridiculous (like this test is doing) you're opening yourself up to instances that can stack overflow. The reason why I hadn't caught this SO at the time was that it isn't actually occurring if you run |
That max depth is being passed to the parser. Is it not using recursion? Or are its stack frames smaller and so there's a range where it wouldn't fail but equals would? |
The |
Should I not be concerned then that you could be handed an arbitrary JsonElement, call DeepEquals, and crash due to stack overflow? |
The algorithm could be made iterative at the expense of allocating a stack, but it doesn't seem particularly worthwhile to me. |
/ba-g unrelated test failure, merging to fix crashing test. |
Resolves a stack overflow that only occurs when running netfx tests using xunit.console.
cc @buyaa-n