Print Page | Close Window

Repro Bug in CXTPSyntaxEditLexTagsAutomat

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=7736
Printed Date: 16 November 2024 at 10:36pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Repro Bug in CXTPSyntaxEditLexTagsAutomat
Posted By: MacW
Subject: Repro Bug in CXTPSyntaxEditLexTagsAutomat
Date Posted: 04 August 2007 at 9:28am
I have a reproducible crash while loading an XML file in the method

CXTPSyntaxEditLexTagsAutomat::_FindWord

Visual C++ reports "Run-Time Check Failure #2 - Stack around the variable 'dwChar2' was corrupted." in the line


            WORD dwChar2 = 0;
            TCSNCCPY_S((LPTSTR)&dwChar2, sizeof(TCHAR) + 1, pcszBuffer, 1);
            rstrWord += (LPCTSTR)&dwChar2;


sizeof(TCHAR) + 1 is used to specify the size of the WORD stack variable, which fails when you compile in with _UNICODE defined.







Replies:
Posted By: sserge
Date Posted: 05 August 2007 at 4:37pm
Hi,

Thanks, this has been already fixed for the next version. Below is the code update if needed:

if (m_ptrWordsMap_not)
{
    if (!m_ptrWordsMap_not->FindWord(bMinWord, pcszBuffer, rstrWord, nBufSize, bConvertToLowerCase, bIgnoreCaseDyn))
    {
        DWORD dwChar2 = 0;
        TCSNCCPY_S((LPTSTR)&dwChar2, 2, pcszBuffer, 1);
        rstrWord += (LPCTSTR)&dwChar2;
        return TRUE;
    }
}


--
WBR,
Serge


Posted By: MacW
Date Posted: 11 August 2007 at 9:25am
Thanks.
I'll do the patch here and wait for the next release.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net