VirusTotal / yara

The pattern matching swiss knife
https://virustotal.github.io/yara/
BSD 3-Clause "New" or "Revised" License
8.13k stars 1.42k forks source link

Compiled x64 dll system.accessviolationexception #1908

Closed ApoIIy0n closed 1 year ago

ApoIIy0n commented 1 year ago

Describe the bug The moment I compile a x64 dll I'm getting this exception the moment I add more than 1 yara rule (which are basic rules..)

To Reproduce compile with these settings in the project file `

_CRT_SECURE_NO_WARNINGS;HASH_MODULE;HAVE_LIBCRYPTO;USE_WINDOWS_PROC;YR_BUILDING_DLL;BUCKETS_128;CHECKSUM_1B;PCRE_STATIC;_WINDLL;_MBCS ..\..\..\libyara;..\..\..\libyara\include;..\..\..;..\packages\YARA.Jansson.x64.1.1.0\include;..\packages\YARA.OpenSSL.x64.1.1.1\include;%(AdditionalIncludeDirectories) 4005;4273;4090;4996 CompileAsC $(IntDir)/%(RelativeDir) false MultiThreadedDLL AnySuitable true Speed false
<Lib>
  <AdditionalDependencies>jansson.lib;libcrypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
  <SuppressStartupBanner>true</SuppressStartupBanner>
  <LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
  <AdditionalLibraryDirectories>..\packages\YARA.OpenSSL.x64.1.1.1\lib;..\packages\YARA.Jansson.x64.1.1.0\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
  <AdditionalOptions>/IGNORE:4221</AdditionalOptions>
</Lib>
<Link>
  <AdditionalDependencies>msvcrt.lib;Ws2_32.lib;crypt32.lib;..\packages\YARA.Jansson.x64.1.1.0\lib\jansson.lib;..\packages\YARA.OpenSSL.x64.1.1.1\lib\libcrypto.lib;..\packages\YARA.OpenSSL.x64.1.1.1\lib\libssl.lib;kernel32.lib;user32.lib;gdi32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
  <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
  <GenerateDebugInformation>No</GenerateDebugInformation>
  <ShowProgress>LinkVerboseLib</ShowProgress>
</Link>
<ProjectReference>
  <LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>

`

Expected behavior A working proper dll

Please complete the following information:

Additional context Is there anyone who has knowledge how to compile a proper dll with this? I'm using an old version atm, but truly want to have the latest updates as well...

ApoIIy0n commented 1 year ago

this is fixed with the latest commits!