Discussion:
help - wininet crash
(too old to reply)
dindin
2006-05-11 08:04:00 UTC
Permalink
My computer is winxp sp2 ,Microsoft Internet Explorer 6 SP2
My app use the wininet api to get http data, but sometimes it crash,
now I record the crash info , please help me out . thanks !
Unhandled exception: 05/11/2006 15:31:36
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 01949008 00:00000000
EAX:780195B0 EBX:00203DD0
ECX:01955E28 EDX:00000020
ESI:00CC000CEDI:00000001
CS:EIP:001B:01949008
SS:ESP:0023:0595FCC8 EBP:0595FCDC
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010282
AddressFrame
019490080595FCDC
0000:00000000
766A6F270595FE20
0001:00025F27 D:\WINDOWS\system32\WININET.dll
7669EAC40595FE3C
0001:0001DAC4 D:\WINDOWS\system32\WININET.dll
7669E8DA0595FE58
0001:0001D8DA D:\WINDOWS\system32\WININET.dll
766950490595FE7C
0001:00014049 D:\WINDOWS\system32\WININET.dll
7669520E0595FE9C
0001:0001420E D:\WINDOWS\system32\WININET.dll
76694B6E0595FEB8
0001:00013B6E D:\WINDOWS\system32\WININET.dll
766A73A40595FEE0
0001:000263A4 D:\WINDOWS\system32\WININET.dll
77F494980595FEF8
0001:00008498 D:\WINDOWS\system32\SHLWAPI.dll
7C9475450595FF40
0001:00026545 D:\WINDOWS\system32\ntdll.dll
7C9475830595FF60
0001:00026583 D:\WINDOWS\system32\ntdll.dll
7C9476450595FF74
0001:00026645 D:\WINDOWS\system32\ntdll.dll
7C94761C0595FFB4
0001:0002661C D:\WINDOWS\system32\ntdll.dll
7C80B50B0595FFEC
0001:0000A50B D:\WINDOWS\system32\kernel32.dll
Scherbina Vladimir
2006-05-12 23:28:34 UTC
Permalink
Put your code to allow us to detect what's wrong.
--
--
Vladimir
Post by dindin
My computer is winxp sp2 ,Microsoft Internet Explorer 6 SP2
My app use the wininet api to get http data, but sometimes it crash,
now I record the crash info , please help me out . thanks !
Unhandled exception: 05/11/2006 15:31:36
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 01949008 00:00000000
EAX:780195B0 EBX:00203DD0
ECX:01955E28 EDX:00000020
ESI:00CC000CEDI:00000001
CS:EIP:001B:01949008
SS:ESP:0023:0595FCC8 EBP:0595FCDC
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010282
AddressFrame
019490080595FCDC
0000:00000000
766A6F270595FE20
0001:00025F27 D:\WINDOWS\system32\WININET.dll
7669EAC40595FE3C
0001:0001DAC4 D:\WINDOWS\system32\WININET.dll
7669E8DA0595FE58
0001:0001D8DA D:\WINDOWS\system32\WININET.dll
766950490595FE7C
0001:00014049 D:\WINDOWS\system32\WININET.dll
7669520E0595FE9C
0001:0001420E D:\WINDOWS\system32\WININET.dll
76694B6E0595FEB8
0001:00013B6E D:\WINDOWS\system32\WININET.dll
766A73A40595FEE0
0001:000263A4 D:\WINDOWS\system32\WININET.dll
77F494980595FEF8
0001:00008498 D:\WINDOWS\system32\SHLWAPI.dll
7C9475450595FF40
0001:00026545 D:\WINDOWS\system32\ntdll.dll
7C9475830595FF60
0001:00026583 D:\WINDOWS\system32\ntdll.dll
7C9476450595FF74
0001:00026645 D:\WINDOWS\system32\ntdll.dll
7C94761C0595FFB4
0001:0002661C D:\WINDOWS\system32\ntdll.dll
7C80B50B0595FFEC
0001:0000A50B D:\WINDOWS\system32\kernel32.dll
Scherbina Vladimir
2006-05-16 16:15:38 UTC
Permalink
Hello, dindin.

I look through your code and have several suggestions (I am not sure it will
help you):

1. void CALLBACK CAsyncGetHttpFile::InternetCallback(...)

Has following code:

CAsyncGetHttpFile * pObj = (CAsyncGetHttpFile*)dwContext;
VERIFY(pObj);
if (!pObj->IsKindOf(RUNTIME_CLASS(CAsyncGetHttpFile)))
return;

which is totally wrong, because if somebody passed wrong contenxt (say, not
a class object) you will get access violation when trying to call IsKindOf.
The problem is in the vtable. If somebody passed wrong object(NOT A pointer
to CAsyncGetHttpFile) it does not have in it's vtable IsKindOf method.

So you'd better check the pointer you have with IsbadReadPtr and then
casting it to CAsyncGetHttpFile and then checking some internal field that
indicates that object is "good".

2. CString CAsyncGetHttpFile::GetWebData(CString szUrl)

Initializing such a huge arrays in stack as: char cResult[50*1024]; may
cause stack override because stack's space might end (in case of a deep
recursion, etc)

Try to fix these problems and then tell us how it is going.
--
--
Vladimir
CAsyncGetHttpFile file;
strWebData = file.GetWebData(LPCTSTR(strURL));
Post by Scherbina Vladimir
Put your code to allow us to detect what's wrong.
--
--
Vladimir
Post by dindin
My computer is winxp sp2 ,Microsoft Internet Explorer 6 SP2
My app use the wininet api to get http data, but sometimes it crash,
now I record the crash info , please help me out . thanks !
Unhandled exception: 05/11/2006 15:31:36
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 01949008 00:00000000
EAX:780195B0 EBX:00203DD0
ECX:01955E28 EDX:00000020
ESI:00CC000CEDI:00000001
CS:EIP:001B:01949008
SS:ESP:0023:0595FCC8 EBP:0595FCDC
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010282
AddressFrame
019490080595FCDC
0000:00000000
766A6F270595FE20
0001:00025F27 D:\WINDOWS\system32\WININET.dll
7669EAC40595FE3C
0001:0001DAC4 D:\WINDOWS\system32\WININET.dll
7669E8DA0595FE58
0001:0001D8DA D:\WINDOWS\system32\WININET.dll
766950490595FE7C
0001:00014049 D:\WINDOWS\system32\WININET.dll
7669520E0595FE9C
0001:0001420E D:\WINDOWS\system32\WININET.dll
76694B6E0595FEB8
0001:00013B6E D:\WINDOWS\system32\WININET.dll
766A73A40595FEE0
0001:000263A4 D:\WINDOWS\system32\WININET.dll
77F494980595FEF8
0001:00008498 D:\WINDOWS\system32\SHLWAPI.dll
7C9475450595FF40
0001:00026545 D:\WINDOWS\system32\ntdll.dll
7C9475830595FF60
0001:00026583 D:\WINDOWS\system32\ntdll.dll
7C9476450595FF74
0001:00026645 D:\WINDOWS\system32\ntdll.dll
7C94761C0595FFB4
0001:0002661C D:\WINDOWS\system32\ntdll.dll
7C80B50B0595FFEC
0001:0000A50B D:\WINDOWS\system32\kernel32.dll
dindin
2006-05-18 02:46:26 UTC
Permalink
In fact, the crash always in

if (!pObj->IsKindOf(RUNTIME_CLASS(CAsyncGetHttpFile)))
return;

because the dwContext of the callback isn't the correct address, it's
generated by callback.
I don't know why the callback will return the wrong address.
Post by Scherbina Vladimir
Hello, dindin.
I look through your code and have several suggestions (I am not sure it
1. void CALLBACK CAsyncGetHttpFile::InternetCallback(...)
CAsyncGetHttpFile * pObj = (CAsyncGetHttpFile*)dwContext;
VERIFY(pObj);
if (!pObj->IsKindOf(RUNTIME_CLASS(CAsyncGetHttpFile)))
return;
which is totally wrong, because if somebody passed wrong contenxt (say,
not a class object) you will get access violation when trying to call
IsKindOf. The problem is in the vtable. If somebody passed wrong
object(NOT A pointer to CAsyncGetHttpFile) it does not have in it's vtable
IsKindOf method.
So you'd better check the pointer you have with IsbadReadPtr and then
casting it to CAsyncGetHttpFile and then checking some internal field
that indicates that object is "good".
2. CString CAsyncGetHttpFile::GetWebData(CString szUrl)
Initializing such a huge arrays in stack as: char cResult[50*1024]; may
cause stack override because stack's space might end (in case of a deep
recursion, etc)
Try to fix these problems and then tell us how it is going.
--
--
Vladimir
CAsyncGetHttpFile file;
strWebData = file.GetWebData(LPCTSTR(strURL));
Post by Scherbina Vladimir
Put your code to allow us to detect what's wrong.
--
--
Vladimir
Post by dindin
My computer is winxp sp2 ,Microsoft Internet Explorer 6 SP2
My app use the wininet api to get http data, but sometimes it crash,
now I record the crash info , please help me out . thanks !
Unhandled exception: 05/11/2006 15:31:36
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 01949008 00:00000000
EAX:780195B0 EBX:00203DD0
ECX:01955E28 EDX:00000020
ESI:00CC000CEDI:00000001
CS:EIP:001B:01949008
SS:ESP:0023:0595FCC8 EBP:0595FCDC
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010282
AddressFrame
019490080595FCDC
0000:00000000
766A6F270595FE20
0001:00025F27 D:\WINDOWS\system32\WININET.dll
7669EAC40595FE3C
0001:0001DAC4 D:\WINDOWS\system32\WININET.dll
7669E8DA0595FE58
0001:0001D8DA D:\WINDOWS\system32\WININET.dll
766950490595FE7C
0001:00014049 D:\WINDOWS\system32\WININET.dll
7669520E0595FE9C
0001:0001420E D:\WINDOWS\system32\WININET.dll
76694B6E0595FEB8
0001:00013B6E D:\WINDOWS\system32\WININET.dll
766A73A40595FEE0
0001:000263A4 D:\WINDOWS\system32\WININET.dll
77F494980595FEF8
0001:00008498 D:\WINDOWS\system32\SHLWAPI.dll
7C9475450595FF40
0001:00026545 D:\WINDOWS\system32\ntdll.dll
7C9475830595FF60
0001:00026583 D:\WINDOWS\system32\ntdll.dll
7C9476450595FF74
0001:00026645 D:\WINDOWS\system32\ntdll.dll
7C94761C0595FFB4
0001:0002661C D:\WINDOWS\system32\ntdll.dll
7C80B50B0595FFEC
0001:0000A50B D:\WINDOWS\system32\kernel32.dll
Scherbina Vladimir
2006-05-18 11:55:04 UTC
Permalink
This may occure when the object is dead but the callback is still called.
The dwContext points to an invalid location in stack (in our case it's
stack - as I see from your code). Make sure that in descructor you cancel
the all IO operations.
--
--
Vladimir
Post by dindin
In fact, the crash always in
if (!pObj->IsKindOf(RUNTIME_CLASS(CAsyncGetHttpFile)))
return;
because the dwContext of the callback isn't the correct address, it's
generated by callback.
I don't know why the callback will return the wrong address.
Post by Scherbina Vladimir
Hello, dindin.
I look through your code and have several suggestions (I am not sure it
1. void CALLBACK CAsyncGetHttpFile::InternetCallback(...)
CAsyncGetHttpFile * pObj = (CAsyncGetHttpFile*)dwContext;
VERIFY(pObj);
if (!pObj->IsKindOf(RUNTIME_CLASS(CAsyncGetHttpFile)))
return;
which is totally wrong, because if somebody passed wrong contenxt (say,
not a class object) you will get access violation when trying to call
IsKindOf. The problem is in the vtable. If somebody passed wrong
object(NOT A pointer to CAsyncGetHttpFile) it does not have in it's
vtable IsKindOf method.
So you'd better check the pointer you have with IsbadReadPtr and then
casting it to CAsyncGetHttpFile and then checking some internal field
that indicates that object is "good".
2. CString CAsyncGetHttpFile::GetWebData(CString szUrl)
Initializing such a huge arrays in stack as: char cResult[50*1024]; may
cause stack override because stack's space might end (in case of a deep
recursion, etc)
Try to fix these problems and then tell us how it is going.
--
--
Vladimir
CAsyncGetHttpFile file;
strWebData = file.GetWebData(LPCTSTR(strURL));
Post by Scherbina Vladimir
Put your code to allow us to detect what's wrong.
--
--
Vladimir
Post by dindin
My computer is winxp sp2 ,Microsoft Internet Explorer 6 SP2
My app use the wininet api to get http data, but sometimes it crash,
now I record the crash info , please help me out . thanks !
Unhandled exception: 05/11/2006 15:31:36
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 01949008 00:00000000
EAX:780195B0 EBX:00203DD0
ECX:01955E28 EDX:00000020
ESI:00CC000CEDI:00000001
CS:EIP:001B:01949008
SS:ESP:0023:0595FCC8 EBP:0595FCDC
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010282
AddressFrame
019490080595FCDC
0000:00000000
766A6F270595FE20
0001:00025F27 D:\WINDOWS\system32\WININET.dll
7669EAC40595FE3C
0001:0001DAC4 D:\WINDOWS\system32\WININET.dll
7669E8DA0595FE58
0001:0001D8DA D:\WINDOWS\system32\WININET.dll
766950490595FE7C
0001:00014049 D:\WINDOWS\system32\WININET.dll
7669520E0595FE9C
0001:0001420E D:\WINDOWS\system32\WININET.dll
76694B6E0595FEB8
0001:00013B6E D:\WINDOWS\system32\WININET.dll
766A73A40595FEE0
0001:000263A4 D:\WINDOWS\system32\WININET.dll
77F494980595FEF8
0001:00008498 D:\WINDOWS\system32\SHLWAPI.dll
7C9475450595FF40
0001:00026545 D:\WINDOWS\system32\ntdll.dll
7C9475830595FF60
0001:00026583 D:\WINDOWS\system32\ntdll.dll
7C9476450595FF74
0001:00026645 D:\WINDOWS\system32\ntdll.dll
7C94761C0595FFB4
0001:0002661C D:\WINDOWS\system32\ntdll.dll
7C80B50B0595FFEC
0001:0000A50B D:\WINDOWS\system32\kernel32.dll
Loading...