Potential bug fix in ComUtilities

31 views
Skip to first unread message

djMax

unread,
Jan 5, 2010, 10:03:18 AM1/5/10
to csEXWB
I was getting an access violation at certain times when posting forms
(It seemed to happen when sites issued a 302 redirect as a result of a
form post, for whatever that's worth). Microsoft helped me blame
ComUtilities, which got me digging deeper. It seems that in some
cases, IE calls CManagedAppBridge::Start instead of calling
CManagedAppBridge::StartEx. The existing ComUtilities code is not
designed to handle this case, because it uses the m_OriUri pointer in
Start which is set by StartEx. The funny bit is there's a line in
StartEx (line 397) to reset that pointer, but it's commented out.
Additionally, m_OriUri is not initialized to null in the constructor.
So I fixed this problem by doing several things:

ManagedAppBridge.h - Initialize m_OriUri in the constructor:
m_pUtilMan(0), m_pvData(0), m_dwPos(0), m_dwDataLength(0), m_lpOriUrl
(0), m_bindf(0), m_OriUri(0)

ManagedAppBridge.cpp - Added a little pointer swap on line 412 to
"consume" the one set by startex right away:
IUri* originalUri = m_OriUri;
m_OriUri = NULL; // next time this function comes around, we don't
want to get a stale pointer

ManagedAppBridge.cpp - check originalUri before using it, and if null,
fall back on Start of the underlying protocol handler (this is now
line 578 after the previous change):
if(m_spInternetProtocolEx && originalUri != NULL)

Reply all
Reply to author
Forward
0 new messages