Opened 7 months ago

Last modified 7 months ago

#1453 new defect

Running MinGW-produced Chicken from a MSVC-produced executable causes a stack overflow during initialization

Reported by: jrobbins Owned by:
Priority: major Milestone: someday
Component: unknown Version: 4.13.0
Keywords: Cc:
Estimated difficulty:

Description

I am on Windows. I have a program, compiled via MSVC, that has a dependency on libchicken.dll, compiled via MinGW, both 64 bit. It successfully calls CHICKEN_run with the default toplevel, but during the loading of the modules, the program segfaults with a stack overflow error in various places, usually around the time it hits loading modules.scm.

It seems that Chicken underestimates the size of the stack when ran in this manner, causing it to run out of stack space much sooner than it anticipates, causing the segfault when it fails to resize the stack.

Attached is a set of files that can replicate the issue. Running make should produce call_from_cl.exe, which will segfault when run. The libchicken.dll it needs should be produced via the mingw-msys platform. You'll need MSVC's cl.exe and lib.exe installed to compile.

Attachments (2)

chicken-crash.tar.gz (689 bytes) - added by jrobbins 7 months ago.
patch.txt (1.5 KB) - added by jrobbins 7 months ago.

Download all attachments as: .zip

Change History (3)

Changed 7 months ago by jrobbins

comment:1 Changed 7 months ago by jrobbins

I have found a solution to the issue- It seems like setjmp/longjmp are known to be buggy in MinGW64. Attached is a patch that solves these issues.

Changed 7 months ago by jrobbins

Note: See TracTickets for help on using tickets.