Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.AccessViolationException #10

Open
ApoIIy0n opened this issue Feb 3, 2023 · 2 comments
Open

System.AccessViolationException #10

ApoIIy0n opened this issue Feb 3, 2023 · 2 comments

Comments

@ApoIIy0n
Copy link

ApoIIy0n commented Feb 3, 2023

I'm getting these access violations randomly while multi-threading. I first thought it was due to the use of a newer yara.dll version, however even when moving back to 4.1.1 (which comes pre-compiled with the NativePack) this problem reoccures randomly.

System.AccessViolationException
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

The file:

  • is not always the same
  • does not exceeds 256 length
  • is not locked nor in use by any other process
  • does not contain special characters
  • is on a normal disk
  • type of file is also random

details:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
   at dnYara.Interop.Methods.yr_rules_scan_file(IntPtr, System.String, Int32, dnYara.Interop.YR_CALLBACK_FUNC, IntPtr, Int32)
--------------------------------
   at dnYara.Scanner.ScanFile(System.String, dnYara.CompiledRules, dnYara.Interop.YR_SCAN_FLAGS)

fyi, I do the following checks to make sure it couldn't be something on my end (hopefully):

  • i check if the file exist
  • i check if the scanner isn't null (though it be odd if it would be I suppose..)
  • check if the rules contain any rules
  • have it all in a try/catch (though this does not get caught by it.., since HandleProcessCorruptedStateExceptions isn't supported by .net core)

Am I doing something wrong here or is there something seriously broken?

@lld1995
Copy link

lld1995 commented Jun 30, 2023

@ApoIIy0n
Copy link
Author

ApoIIy0n commented Jun 30, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants