Access violation when using Fiddler OM

3 posts, 0 answers
  1. Jeremy
    Jeremy avatar
    2 posts
    Member since:
    Jun 2018

    Posted 06 Jun Link to this post

    We're hitting a sporadic access violation when using the Fiddler OM in our test automation. I have not been able to find anything indicating this is an issue with our code, but I'm still digging

    Inside our internal event handler, the relevant code is:

        session["https-Client-Certificate"] = "FiddlerCert.cer"; <-- this has me wondering if it's possible for a corrupt or invalid cert to cause the below crash
        session.bBufferResponse = true;
        string requestBody = session.GetRequestBodyAsString(); <-- crash happens here

     

    Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

       at System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, DecoderNLS baseDecoder)
       at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding)
       at System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)
       at System.Text.Encoding.GetString(Byte[] bytes)
       at Fiddler.Utilities.GetStringFromArrayRemovingBOM(Byte[] arrInput, Encoding oDefaultEncoding)
       at Fiddler.Session.GetRequestBodyAsString()
       at <INTERNAL NAMESPACE REMOVED>.FiddlerApplication_BeforeRequest(Session session)
       at Fiddler.SessionStateHandler.Invoke(Session oSession)
       at Fiddler.FiddlerApplication.DoBeforeRequest(Session oSession)
       at Fiddler.Session._executeObtainRequest()
       at Fiddler.Session.InnerExecute()
       at Fiddler.Session.Execute(Object objThreadState)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

     

    Has anyone seen this before, or know of a fix or workaround? I'd like to think that even in the case of a corrupt/bad/missing certificate, an AV wouldn't happen, but without the Fiddler source, there's no great way for me to prove that (yes, I could disassemble, but I haven't yet).


  2. Jeremy
    Jeremy avatar
    2 posts
    Member since:
    Jun 2018

    Posted 06 Jun in reply to Jeremy Link to this post

    Oh, and we're using FiddlerCore4 v4.5.1.0, in case that helps.
  3. Simeon
    Admin
    Simeon avatar
    116 posts

    Posted 12 Jun Link to this post

    Hi Jeremy,

    session["https-Client-Certificate"] = "FiddlerCert.cer"; <-- this has me wondering if it's possible for a corrupt or invalid cert to cause the below crash
    I believe that a corrupt or invalid cert would cause a different type of crash involving some kind of SecurityException.

    Based on the stack trace you provided, the exception is thrown at the System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, DecoderNLS baseDecoder) method. FYR, here is the source code.

    I managed to think for 3 probable causes for the AccessViolationException:

    The first one is according to the Microsoft's documentation it could be a corrupted memory.

    The second one is that there could be a mismatch between the charset directive of the Content-Type header (utf-8) and the actual encoding of the body or the body is binary data.

    And the last one is that there could be a bug in the System.Text.UTF8Encoding.GetChars method.


    Regards,
    Simeon
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top