Debugging an access violation

4

I'm using a large closed-source framework. I recently added a new entity, and now I'm getting access violations when performing some actions. However, they occur on calls from within the framework, so I don't know what I've implemented wrong, since I don't get a call stack.

The violation is reported in the function _CRTIMP PFLS_GETVALUE_FUNCTION __cdecl __set_flsgetvalue() defined in the CRT file tidtable.c. The specific row is PFLS_GETVALUE_FUNCTION flsGetValue = FLS_GETVALUE;. I'm not sure, but I think it is related to function pointers?

The error message is Unhandled exception at 0x0000007a in fmwk.exe: 0xC0000005: Access violation reading location 0x0000007a.. My interpretation is that it's attempting to access something at offset 0x7a into an object, but it's acually given a null pointer. Is this correct? If it is, is there a way of finding what that offset corresponds to?

Below is the call stack:

0000007a()  
fmwk.dll!100f2630()     
[Frames below may be incorrect and/or missing, no symbols loaded for fmwk.dll]  

<lots of framework and windows dlls>

fmwk.exe!00402ef4()     
msvcr100.dll!__set_flsgetvalue()  Line 145 + 0xc bytes  C
msvcr100.dll!_getptd_noexit()  Line 498 + 0x7 bytes C
msvcr100.dll!_getptd()  Line 523 + 0x5 bytes    C
msvcr100.dll!_LocaleUpdate::_LocaleUpdate(localeinfo_struct * plocinfo=0x00000000)  Line 243 + 0x5 bytes    C++
msvcr100.dll!x_ismbbtype_l(localeinfo_struct * plocinfo=0x00000000, unsigned int tst=0, int cmask=1386664, int kmask=1414714)  Line 219 C++
msvcr100.dll!_ismbblead(unsigned int tst=0)  Line 172 + 0xe bytes   C++
fmwk.exe!004010a0()     
fmwk.exe!00404d61()     
kernel32.dll!7c817077()     
c++
debugging
access-violation
asked on Stack Overflow Aug 29, 2011 by carlpett

2 Answers

2

Use Application Verifier to debug this access violation. It should stop execution earlier when bad thing happens with better call stack than this one.

Looks like you dereferenced NULL pointer somewhere but program did not crash immediately since it is Undefined Behaviour, continued executing and crashed a bit later with weird call stack.

answered on Stack Overflow Aug 29, 2011 by ks1322 • edited Aug 29, 2011 by ks1322
0

Regarding your question: Yes, accessing 0x7A suspiciously looks like dereferencing a NULL pointer at offset 0x7a. (Could also be something like dereferencing 0x20 with offset 0x5a though).

Without source code access it is hard to find out what's going on. You could try backtracking with your code and figure out which change you made that made the framework to bail out. Then, see if you are using a framework function different from how it is supposed to be used. If this all seems to lead to no end, you could also report a bug to your framework vendor, but I'd advise you to make sure the fault is not on your side before you do that.

answered on Stack Overflow Aug 29, 2011 by BjoernD

User contributions licensed under CC BY-SA 3.0