Debug Error into DBHHEAP.C 
Author Message
 Debug Error into DBHHEAP.C

Hi!

Working with VC++6.0 (+Visual Studio SP5) on WinNT4.0 (+SP6a)

I am developing an application. I do not find any problem when
compiling:

char dataA[3][100];
char dataB[3][100];
char dataC[3][100];
char *value;
....
if (name.equals("A")) {

        strcpy(dataA[i], value);
        cout << "VALUE A =" << value << "\n";

Quote:
}

if (name.equals("B")) {

        strcpy(dataB[i], value);
        cout << "VALUE B =" << value << "\n";

Quote:
}

if (name.equals("C")) {

        strcpy(dataC[i], value);  // Line X
        cout << "VALUE C =" << value << "\n";

Quote:
}

But when executing, if I do not 'comment' Line X, I get
the next error message:

<<Debug Error - DAMAGE: after normal block (#59) at 0x00455A>>

If I check the debug, the error is placed at 'DBGHEAP.c':

if (!CheckBytes(pbData(pHead) + pHead->nDataSize, _bNoMansLandFill,
nNoMansLandSize))
    _RPT3(_CRT_ERROR, "DAMAGE: after %hs block (#%d) at 0x%08X.\n",
    szBlockUseName[_BLOCK_TYPE(pHead->nBlockUse)],
    pHead->lRequest,
   (BYTE *) pbData(pHead));  <--- Here

Do I have allocated a buffer too small than I need?
How can I solve this?

Regards.



Tue, 07 Oct 2003 01:26:50 GMT  
 Debug Error into DBHHEAP.C
looks like your buffer is too small ...
Every now and again I make a silly mistake akin to:

void foo(char *lpszInput)
{
    _ASSERT(lpszInput);
    if(lpszInput)
    {
        char *pszBuffer = new char[strlen(lpszInput)];
        strcpy(pszBuffer, lpszInput);       // this overwrites passed the
bounds of my local buffer
        delete [] pszBuffer;                     // this line causes the
same Debug Error
    }

Quote:
}

This is a result of not allocating space for the '\0' at the end ... The
strcpy is really the bandit here, but
it only manifests itself at the delete.

HTH,
Joshua Emele


Quote:
> Hi!

> Working with VC++6.0 (+Visual Studio SP5) on WinNT4.0 (+SP6a)

> I am developing an application. I do not find any problem when
> compiling:

> char dataA[3][100];
> char dataB[3][100];
> char dataC[3][100];
> char *value;
> ....
> if (name.equals("A")) {

> strcpy(dataA[i], value);
> cout << "VALUE A =" << value << "\n";
> }
> if (name.equals("B")) {

> strcpy(dataB[i], value);
> cout << "VALUE B =" << value << "\n";
> }
> if (name.equals("C")) {

> strcpy(dataC[i], value);  // Line X
> cout << "VALUE C =" << value << "\n";
> }

> But when executing, if I do not 'comment' Line X, I get
> the next error message:

> <<Debug Error - DAMAGE: after normal block (#59) at 0x00455A>>

> If I check the debug, the error is placed at 'DBGHEAP.c':

> if (!CheckBytes(pbData(pHead) + pHead->nDataSize, _bNoMansLandFill,
> nNoMansLandSize))
>     _RPT3(_CRT_ERROR, "DAMAGE: after %hs block (#%d) at 0x%08X.\n",
>     szBlockUseName[_BLOCK_TYPE(pHead->nBlockUse)],
>     pHead->lRequest,
>    (BYTE *) pbData(pHead));  <--- Here

> Do I have allocated a buffer too small than I need?
> How can I solve this?

> Regards.



Tue, 07 Oct 2003 03:05:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Debug Error into DBHHEAP.C

2. Newbie: separate big .cs file into small .cs files

3. Compiler error CS 1595 - Help

4. Run time Release mode error but no Debug mode error

5. How to show/call Form2.cs from Form1.cs ?

6. VC++.NET Build/Debug/Compile Error Codes: Where and How to Find

7. DEBUG ASSERT Error????

8. Runtime error in Release but not Debug

9. strange debug error

10. Rich-Error info lost on Attributed ATL project in remote debug config (again)

11. BUG: DEBUG member in enum in class syntax error C2059

12. Threading error in form called from legacy C++ app (Was: Debugging with drag and drop)

 

 
Powered by phpBB® Forum Software