Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CAtlRegExp bug with Visual Studio 2005 SP1

28 views
Skip to first unread message

Roman Ryl...

unread,
Sep 23, 2007, 5:50:05 PM9/23/07
to
Hi,

I have recently encountered another bug with ATL's regular expression
class, Visual Studio 2005 SP1. Match method jumps beyond of the
argument string what can end up with access violation etc.

This is the code to reproduce the problem:

===
CAtlRegExp<CAtlRECharTraitsA> Expression;
ATLVERIFY(Expression.Parse(" *{[^ \\=\\,]+ *}( *\\= *(({[^ \\,\\\"]
+?})|(\\\"{[^\\\"]+?}\\\")) *)?(\\, *)?", FALSE) == REPARSE_ERROR_OK);
static CHAR g_pszValue[] = "realm=\"Session streamed by RTP/RTSP
server\", nonce=\"c26b8dbee7f21b41de1f7ef9a56d5695\"";
for(LPCSTR pszPointer = g_pszValue; ; )
{
CAtlREMatchContext<CAtlRECharTraitsA> MatchContext;
LPCSTR pszNewPointer;
if(!Expression.Match(pszPointer, &MatchContext, &pszNewPointer))
break;
ATLASSERT(pszNewPointer <= g_pszValue + strlen(g_pszValue) + 1);
pszPointer = pszNewPointer;
}
===

The code stops at ATLASSERT.

And this is what I believe to be a fix for the problem (atlrx.h):

===
case RE_ADVANCE:

// FIX: Roman's fix for !*szCurrInput bug
#if TRUE
if(*szCurrInput == '\0')
goto Error;
#endif

sz = CharTraits::Next(szCurrInput);
szCurrInput = sz;
if (*sz == '\0')
goto Error;
ip = 0;
pContext->m_nTos = 0;
break;
===

I hope this information is useful.

Roman

David Lowndes

unread,
Sep 24, 2007, 4:20:55 AM9/24/07
to
>I have recently encountered another bug with ATL's regular expression
>class, Visual Studio 2005 SP1. Match method jumps beyond of the
>argument string what can end up with access violation etc.

Roman,

I can only suggest that you try to pass this on to
http://www.codeplex.com/AtlServer/ - the regular expression code is
now maintained there.

Dave

Roman Ryl...

unread,
Sep 24, 2007, 4:53:41 AM9/24/07
to
Dave,

> I can only suggest that you try to pass this on tohttp://www.codeplex.com/AtlServer/- the regular expression code is
> now maintained there.

Thank for the hint, I will pass this.

Roman


0 new messages