JustasMasiulis / xorstr

heavily vectorized c++17 compile time string encryption.
Apache License 2.0
1.19k stars 193 forks source link

weird crashing on long strings #61

Closed hessfire closed 11 months ago

hessfire commented 11 months ago

executing this code (on both x86 and x64 arch) crashes on third line

MessageBoxA(0, xorstr("test"), 0, 0); MessageBoxA(0, xorstr("longertest"), 0, 0); MessageBoxA(0, xorstr("muchlongertest!!!"), 0, 0);

test and longertest displays normally but when it comes to display 'muchlongertest!!!' i get crashed with following reason:

r

JustasMasiulis commented 11 months ago

#define JM_XORSTR_DISABLE_AVX_INTRINSICS

hessfire commented 11 months ago

#define JM_XORSTR_DISABLE_AVX_INTRINSICS

already tried, still same

JustasMasiulis commented 11 months ago

Please open the disassembly view and show the instruction that's invalid then. You can also post the code you use if it's something small

hessfire commented 11 months ago

Please open the disassembly view and show the instruction that's invalid then. You can also post the code you use if it's something small

disaster_1 disaster_2

hessfire commented 11 months ago

adding #define JM_XORSTR_DISABLE_AVX_INTRINSICS changes nothing, disassembly looks exactly same

hessfire commented 11 months ago

oh, wait, i think i figured out

i should add #define JM_XORSTR_DISABLE_AVX_INTRINSICS inside of xor.h file but not inside my main file

hessfire commented 11 months ago

closing as completed

JustasMasiulis commented 11 months ago

oh, wait, i think i figured out

i should add #define JM_XORSTR_DISABLE_AVX_INTRINSICS inside of xor.h file but not inside my main file

it can be in your main file as long as it's placed before the #include or alternatively you can add it in you compiler settings