capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.33k stars 1.54k forks source link

CMake Windows Build Crashes #2416

Open eyalgolan1337 opened 1 month ago

eyalgolan1337 commented 1 month ago

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.

Rot127 commented 1 month ago

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?

eyalgolan1337 commented 1 month ago

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