capstone icon indicating copy to clipboard operation
capstone copied to clipboard

CMake Windows Build Crashes (32bit)

Open eyalgolan1337 opened this issue 1 year ago • 4 comments

Work environment

Questions Answers
OS/arch/bits Windows x86
Architecture x86
Source of Capstone git clone, reproduces with vcpkg port which uses cmake for windows
Version/git commit v5.0.1

Expected behavior

When compiling the library for windows using the CMake buildsystem for x86 32 bit it should produce a working binary.

Actual behavior

The library lib file produced causes a null-dereference when using cs_disasm.

Steps to reproduce the behavior

Compile for windows x86 32 bit Release static using the CMake buildsystem and then run test_basic.exe - the test crashes almost immediately. Preferably use the vcpkg port version which uses CMake both for Linux and Windows binaries.

eyalgolan1337 avatar Jul 29 '24 19:07 eyalgolan1337

It will take a while until I have a working Windows VM set up. Would you mind building the next branch with ASAN enabled (-DENABLE_ASAN=1), so we get a stack trace?

Rot127 avatar Jul 30 '24 04:07 Rot127

The crash does not reproduce when test_basic.exe is compiled from the next branch, and when compiling 5.0.1 with asan no trace is produced and only a windows popup shows that says the program has stopped working.

Unfortunatly, although the tests pass when using next my binary still manages to reproduce the crash, but I can't attach it here. My suggestion is to try and work on a windows 32-bit machine and run the test_basic.exe from version 5.0.1 and fix the bug this way

eyalgolan1337 avatar Jul 30 '24 12:07 eyalgolan1337

@kabeor Would support Windows 32bit? Personally I think it is too much maintenance work at the current time. Also I think it is not supported by Github actions. So we can't test it

Rot127 avatar Sep 10 '24 13:09 Rot127

We discovered before that it also crashes in the next branch. Generally Capstone should work on 32bit systems as well.

Rot127 avatar Jun 14 '25 13:06 Rot127