File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,17 @@ LONG CALLBACK seh_vectored_exception_handler(EXCEPTION_POINTERS* ep)
151
151
switch (er -> ExceptionCode ) {
152
152
case EXCEPTION_STACK_OVERFLOW :
153
153
if (!mono_aot_only && restore_stack ) {
154
+ if (er -> NumberParameters == 2 ) {
155
+ /* Use actual stack fault address rather than relying on the
156
+ * SP of the current frame. If we try to enter a method with a
157
+ * large prolog (many locals) we may try to allocate more stack
158
+ * than is available, however the SP has not been updated. This
159
+ * means the stack overflow heuristic to free up enough space
160
+ * may fail, as the used stack may be smaller than the amount
161
+ * of stack that was attempted to be unwound.
162
+ */
163
+ ctx -> Rsp = er -> ExceptionInformation [1 ]; /* FaultAddress */
164
+ }
154
165
if (mono_arch_handle_exception (ctx , domain -> stack_overflow_ex )) {
155
166
/* need to restore stack protection once stack is unwound
156
167
* restore_stack will restore stack protection and then
You can’t perform that action at this time.
0 commit comments