Re: Unhandled exception

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Noël Danjou (noel_at_noeld.com)
Date: 04/21/04


Date: Wed, 21 Apr 2004 17:12:28 +0200

Hi Gary,

Thanks for reviewing this thread.

Just like you I don't trust the "workaround" though each time the ASSERT
line is present the exception does not occur!

By the way I recompiled the whole code with BoundsChecker (BC) 7.2 and tried
again, the same behavior happens and BC does not report any stack corruption
or overrun. Now I recompiled the whole code w/o BC.

I identified the exact line in the disassembly which causes the problem
though I still don't understand why.

Here is what happens when I put the ASSERT line and the code works:

BOOL CWebRequest::SaveResponse(LPCTSTR pszFileName)
{

ebp = 12f998

004FB330 push ebp

esp = 12f964

004FB331 mov ebp,esp
004FB333 push 0FFFFFFFFh

esp = 12f960

004FB335 push offset
__ehhandler$?SaveResponse@CWebRequest@@QAEHPBD@Z (669A16h)

esp = 12f95c

004FB33A mov eax,dword ptr fs:[00000000h]
004FB340 push eax

esp = 12f958

004FB341 mov dword ptr fs:[0],esp
004FB348 push ecx

esp = 12f954

004FB349 sub esp,80h

esp = 12f8d4 -> expected and the remaining of the code is correctly executed

Now same code without the ASSERT line:

BOOL CWebRequest::SaveResponse(LPCTSTR pszFileName)
{

ebp = 12f998

004FB330 push ebp

esp = 12f964

004FB331 mov ebp,esp
004FB333 push 0FFFFFFFFh

esp = 12f960

004FB335 push offset
__ehhandler$?SaveResponse@CWebRequest@@QAEHPBD@Z (669A16h)

esp = 12f95c

004FB33A mov eax,dword ptr fs:[00000000h]
004FB340 push eax

esp = 12f958

004FB341 mov dword ptr fs:[0],esp
004FB348 push ecx

esp = 12f954

004FB349 sub esp,80h

esp = ff46f888 -> wrong hence unhandled exception

Unhandled exception at 0x004fb32f in TestApp.exe: 0xC0000005: Access
violation writing location 0xff46f884.

The question is why the sub operation fails????

Unfortunately I cannot upload the code to the public server because it is
part of a big application which cannot be published.

If something can be made through application sharing, remote assistance or
any other method please does not hesitate to contact me through my real
e-mail address. Thank you.

Best regards,

-- 
Noël
http://noeld.com


Relevant Pages

  • Re: Where should I use assert(<pointer>!=NULL)?
    ... If using automated testing tools the use of 'assert' might very well be ... This first case assumes that a NULL-valued 'ptr' is an exceptional ... me that while a runtime check / exception throw will ensure handling of this ... precisely because the programmer knows the possibility will be handled. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: error in compiling 2002 code in 2005
    ... prefix with 'typename' to indicate a type ... return pair<iterator, bool>(iterator(this, x.first), false); ... ASSERT(m_mfcMap.IsEmpty()); ...
    (microsoft.public.vc.mfc)
  • Re: I Need an IsNumeric Method
    ... public bool IsNumeric ... //Try a double conversion. ... try to convert and catch the exception ... > o Don't forget that .5 is generally considered okay, ...
    (microsoft.public.dotnet.languages.csharp)
  • Bbasic file I/O and exception handling. (basic analisys of my Model)
    ... I think both are not correct somehow. ... bool PhoneBook::createDatabase ... Help me with a typcical robust exception code. ... PhoneBook(); ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Question concerning object-oriented programming
    ... Better yet the constructor could throw an exception. ... code has found an assert violation? ... it's a serious issue then I would assume that the assert would either ... Any Object should have a toString() and a palindromic ...
    (comp.programming)