This is a migrated thread and some comments may be shown as answers.

Access violation when using Fiddler OM

4 Answers 119 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 06 Jun 2018, 01:50 PM

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).


4 Answers, 1 is accepted

Sort by
0
Jeremy
Top achievements
Rank 1
answered on 06 Jun 2018, 01:54 PM
Oh, and we're using FiddlerCore4 v4.5.1.0, in case that helps.
0
Simeon
Telerik team
answered on 12 Jun 2018, 04:31 PM
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
0
Michael
Top achievements
Rank 1
answered on 20 Mar 2019, 06:05 AM

[quote]Your quote goes here[/quote]

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.

0
Christopher
Top achievements
Rank 1
answered on 16 Nov 2019, 07:30 AM
[quote]Michael said:

[quote]Your quote goes here[/quote]

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. mykfcexperience

[/quote]

 

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.

Tags
Fiddler Classic
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Jeremy
Top achievements
Rank 1
Simeon
Telerik team
Michael
Top achievements
Rank 1
Christopher
Top achievements
Rank 1
Share this question
or