Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Debug Assertion Failed - Error message

Debug Assertion Failed - Error message

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelpannouncement
14 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R rajaratk

    void FileNameCreate(LPTSTR szPathBuffer, LPTSTR sPath, LPTSTR sFile, LPTSTR sExt) { char szTmpPathBuffer[MAX]; char *sTmpPath= NULL; char *sTmpFile = NULL; char sTmpExt[LEN_MAX]; try { sTmpPath = new char[LEN_MAX]; sTmpFile = new char[LEN_MAX]; TrUnicodeToChar(sPath,sTmpPath); TrUnicodeToChar(sFile,sTmpFile); TrUnicodeToChar(sExt,sTmpExt); FileNameCreate(szTmpPathBuffer, sTmpPath, sTmpFile, sTmpExt,sizeof(szTmpPathBuffer)); TrCharToUnicode(szTmpPathBuffer,szPathBuffer); delete [] sTmpPath; delete [] sTmpFile; } catch(bad_alloc) { if(sTmpPath!=NULL) delete [] sTmpPath; if(sTmpFile!=NULL) delete [] sTmpFile; } } Error message has been occurred only in the text is shown in big letters.

    J Offline
    J Offline
    James R Twine
    wrote on last edited by
    #4

    The code listing is incomplete (missing information on sTmpExt), but my guess is that TrCharToUnicode(...) is overwriting the memory pointed to by szPathBuffer because it is not being told the size of the memory (in TCHARs) being pointed to by szPathBuffer.    Peace!

    -=- James
    Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
    Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
    See DeleteFXPFiles

    1 Reply Last reply
    0
    • R rajaratk

      void FileNameCreate(LPTSTR szPathBuffer, LPTSTR sPath, LPTSTR sFile, LPTSTR sExt) { char szTmpPathBuffer[MAX]; char *sTmpPath= NULL; char *sTmpFile = NULL; char sTmpExt[LEN_MAX]; try { sTmpPath = new char[LEN_MAX]; sTmpFile = new char[LEN_MAX]; TrUnicodeToChar(sPath,sTmpPath); TrUnicodeToChar(sFile,sTmpFile); TrUnicodeToChar(sExt,sTmpExt); FileNameCreate(szTmpPathBuffer, sTmpPath, sTmpFile, sTmpExt,sizeof(szTmpPathBuffer)); TrCharToUnicode(szTmpPathBuffer,szPathBuffer); delete [] sTmpPath; delete [] sTmpFile; } catch(bad_alloc) { if(sTmpPath!=NULL) delete [] sTmpPath; if(sTmpFile!=NULL) delete [] sTmpFile; } } Error message has been occurred only in the text is shown in big letters.

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #5

      char to unicode means also that you need twice the amount of bits to store the output string.:confused:

      Greetings from Germany

      1 Reply Last reply
      0
      • R rajaratk

        Hello, When I am debugging the source code,I got "Debug Assertion Failed" as a heading and the text which shown in big letters. When I see the output i got the following messages. ========================================================================================= Warning: data source is readonly. DBMS: EXCEL Version: 08.00.0000 ODBC Driver Manager Version: 03.52.0000 'omc.exe': Loaded 'C:\WINDOWS\system32\msjtes40.dll', No symbols loaded. 'omc.exe': Loaded 'C:\WINDOWS\system32\vbajet32.dll', No symbols loaded. 'omc.exe': Loaded 'C:\WINDOWS\system32\expsrv.dll', No symbols loaded. 'omc.exe': Unloaded 'C:\WINDOWS\system32\msexcl40.dll' The thread 'Win32 Thread' (0x544) has exited with code 0 (0x0). The thread 'Win32 Thread' (0xcd0) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x958) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x938) has exited with code 0 (0x0). 'omc.exe': Loaded 'C:\WINDOWS\system32\odexl32.dll', No symbols loaded. 'omc.exe': Unloaded 'C:\WINDOWS\system32\odexl32.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\odbcjt32.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\odbcji32.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\msjter40.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\msjint40.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\msjet40.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\mswstr10.dll' HEAP[omc.exe]: Invalid Address specified to RtlValidateHeap( 02440000, 02DEBD00 ) Windows has triggered a breakpoint in omc.exe. This may be due to a corruption of the heap, and indicates a bug in omc.exe or any of the DLLs it has loaded. The output window may have more diagnostic information ======================================================================================== Please if anyone identifies the error let me know. Thanks in advance Ratheesh

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #6

        rajaratk wrote:

        When I am debugging the source code,I got "Debug Assertion Failed"...

        What line of what file is asserting?


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        R 1 Reply Last reply
        0
        • D David Crow

          rajaratk wrote:

          When I am debugging the source code,I got "Debug Assertion Failed"...

          What line of what file is asserting?


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          R Offline
          R Offline
          rajaratk
          wrote on last edited by
          #7

          When I debugging our application, I got the error messages in "output" window of VS2005. 'omc.exe': Unloaded 'C:\WINDOWS\system32\msjet40.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\mswstr10.dll' Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. Also I got the popup message also: "Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted" Please help me to solve this.

          D 1 Reply Last reply
          0
          • R rajaratk

            When I debugging our application, I got the error messages in "output" window of VS2005. 'omc.exe': Unloaded 'C:\WINDOWS\system32\msjet40.dll' 'omc.exe': Unloaded 'C:\WINDOWS\system32\mswstr10.dll' Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. Also I got the popup message also: "Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted" Please help me to solve this.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #8

            But where is the assertion?


            "A good athlete is the result of a good and worthy opponent." - David Crow

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            R 1 Reply Last reply
            0
            • D David Crow

              But where is the assertion?


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              R Offline
              R Offline
              rajaratk
              wrote on last edited by
              #9

              Hi, Thanks a lot for your response. I have added the code snippet which I got debug assertion failed error shown in bold letter: ============================================================ #define MAX 520 #define LEN_MAX 500 void FileNameCreate(LPTSTR szPathBuffer, LPTSTR sPath, LPTSTR sFile, LPTSTR sExt) { char szTmpPathBuffer[MAX]; char *sTmpPath= NULL; char *sTmpFile = NULL; char sTmpExt[LEN_MAX]; try { sTmpPath = new char[LEN_MAX]; sTmpFile = new char[LEN_MAX]; TrUnicodeToChar(sPath,sTmpPath); TrUnicodeToChar(sFile,sTmpFile); TrUnicodeToChar(sExt,sTmpExt); FileNameCreate(szTmpPathBuffer, sTmpPath, sTmpFile, sTmpExt,sizeof(szTmpPathBuffer)); TrCharToUnicode(szTmpPathBuffer,szPathBuffer); delete [] sTmpPath; delete [] sTmpFile; } ========================================================= LPTSTR TrCharToUnicode(char *CharBuffer, LPTSTR csBuffer, size_t uNbChar) { USES_CONVERSION; if(CharBuffer == NULL) return NULL; else { if (uNbChar == 0) uNbChar = strlen (CharBuffer)+1; MultiByteToWideChar(CP_ACP, 0, CharBuffer, uNbChar, csBuffer, uNbChar); return csBuffer; } } ======================================================= Please give me some input to solve this issue. Thanks in advance. -- modified at 2:58 Monday 8th October, 2007

              D 1 Reply Last reply
              0
              • R rajaratk

                Hi, Thanks a lot for your response. I have added the code snippet which I got debug assertion failed error shown in bold letter: ============================================================ #define MAX 520 #define LEN_MAX 500 void FileNameCreate(LPTSTR szPathBuffer, LPTSTR sPath, LPTSTR sFile, LPTSTR sExt) { char szTmpPathBuffer[MAX]; char *sTmpPath= NULL; char *sTmpFile = NULL; char sTmpExt[LEN_MAX]; try { sTmpPath = new char[LEN_MAX]; sTmpFile = new char[LEN_MAX]; TrUnicodeToChar(sPath,sTmpPath); TrUnicodeToChar(sFile,sTmpFile); TrUnicodeToChar(sExt,sTmpExt); FileNameCreate(szTmpPathBuffer, sTmpPath, sTmpFile, sTmpExt,sizeof(szTmpPathBuffer)); TrCharToUnicode(szTmpPathBuffer,szPathBuffer); delete [] sTmpPath; delete [] sTmpFile; } ========================================================= LPTSTR TrCharToUnicode(char *CharBuffer, LPTSTR csBuffer, size_t uNbChar) { USES_CONVERSION; if(CharBuffer == NULL) return NULL; else { if (uNbChar == 0) uNbChar = strlen (CharBuffer)+1; MultiByteToWideChar(CP_ACP, 0, CharBuffer, uNbChar, csBuffer, uNbChar); return csBuffer; } } ======================================================= Please give me some input to solve this issue. Thanks in advance. -- modified at 2:58 Monday 8th October, 2007

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #10

                What line of what file is asserting (hint: it will contain an assert() statement)?


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                R 1 Reply Last reply
                0
                • D David Crow

                  What line of what file is asserting (hint: it will contain an assert() statement)?


                  "A good athlete is the result of a good and worthy opponent." - David Crow

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  R Offline
                  R Offline
                  rajaratk
                  wrote on last edited by
                  #11

                  Hai, Thanks for your response. I got the following errors: 1. Windows has triggered a breakpoint in omc.exe. This may be due to a corruption of the heap, and indicates a bug in omc.exe or any of the DLLs it has loaded. The output window may have more diagnostic information This is shown in the output window of VS2005 2. Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. This one is display as popup window 3.Heap corruption detected at 02DF1B20 First-chance exception at 0x7c949fd5 in omc.exe: 0xC0000005: Access violation reading location 0xcdcdcdd1. AtlThrow: hr = 0x8007000e First-chance exception at 0x7c81eb33 in omc.exe: Microsoft C++ exception: CMemoryException at memory location 0x0011e370.. HEAP[omc.exe]: Heap block at 02DF18C0 modified at 02DF1B06 past requested size of 23e Windows has triggered a breakpoint in omc.exe. This may be due to a corruption of the heap, and indicates a bug in omc.exe or any of the DLLs it has loaded. The output window may have more diagnostic information This is shown in the output window of VS2005 Please give me solution to solve this -- modified at 8:23 Tuesday 9th October, 2007 Now I got the following error message: First-chance exception at 0x7c81eb33 in omc.exe: Microsoft C++ exception: CFileException at memory location 0x0012bdd4.. **CFile exception: badPath, File d:\omc\omc610~1\omcpro~1\targprod\afr100\customer.dbs\test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test523.cdb, OS error information = 3.**First-chance exception at 0x7c81eb33 in omc.exe: Microsoft C++ exception: CFileException at memory location 0x0012b0f4.. Load ACT: INSTALLER AB from d:\omc\omc610_rajaratk_priv_view\omcproject\targprod\afr100\ini\afr100a.ini The thread 'Win32 Thread' (0xc1c) has exited with code 0 (0x0). LockDataBase : The state of the object is signaled The problem is that if I save the file name in 200chars it is accepting. But If i save the file name as 202 chars it will throw an exception. I have given the variable size upto 2000. Please give me your suggestions to solve this issue.

                  D 1 Reply Last reply
                  0
                  • R rajaratk

                    Hai, Thanks for your response. I got the following errors: 1. Windows has triggered a breakpoint in omc.exe. This may be due to a corruption of the heap, and indicates a bug in omc.exe or any of the DLLs it has loaded. The output window may have more diagnostic information This is shown in the output window of VS2005 2. Run-Time Check Failure #2 - Stack around the variable 'sStr' was corrupted. This one is display as popup window 3.Heap corruption detected at 02DF1B20 First-chance exception at 0x7c949fd5 in omc.exe: 0xC0000005: Access violation reading location 0xcdcdcdd1. AtlThrow: hr = 0x8007000e First-chance exception at 0x7c81eb33 in omc.exe: Microsoft C++ exception: CMemoryException at memory location 0x0011e370.. HEAP[omc.exe]: Heap block at 02DF18C0 modified at 02DF1B06 past requested size of 23e Windows has triggered a breakpoint in omc.exe. This may be due to a corruption of the heap, and indicates a bug in omc.exe or any of the DLLs it has loaded. The output window may have more diagnostic information This is shown in the output window of VS2005 Please give me solution to solve this -- modified at 8:23 Tuesday 9th October, 2007 Now I got the following error message: First-chance exception at 0x7c81eb33 in omc.exe: Microsoft C++ exception: CFileException at memory location 0x0012bdd4.. **CFile exception: badPath, File d:\omc\omc610~1\omcpro~1\targprod\afr100\customer.dbs\test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test5test523.cdb, OS error information = 3.**First-chance exception at 0x7c81eb33 in omc.exe: Microsoft C++ exception: CFileException at memory location 0x0012b0f4.. Load ACT: INSTALLER AB from d:\omc\omc610_rajaratk_priv_view\omcproject\targprod\afr100\ini\afr100a.ini The thread 'Win32 Thread' (0xc1c) has exited with code 0 (0x0). LockDataBase : The state of the object is signaled The problem is that if I save the file name in 200chars it is accepting. But If i save the file name as 202 chars it will throw an exception. I have given the variable size upto 2000. Please give me your suggestions to solve this issue.

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #12

                    The errors you show are (CFile) exceptions. Does the path shown in the exception not mean anything to you? For the fourth time, what line of what file is asserting?


                    "A good athlete is the result of a good and worthy opponent." - David Crow

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    R 1 Reply Last reply
                    0
                    • D David Crow

                      The errors you show are (CFile) exceptions. Does the path shown in the exception not mean anything to you? For the fourth time, what line of what file is asserting?


                      "A good athlete is the result of a good and worthy opponent." - David Crow

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      R Offline
                      R Offline
                      rajaratk
                      wrote on last edited by
                      #13

                      It shows the following error messages: Debug Assertion Failed! Program: d:\omc\OMC610_rajaratk_priv_view\omcproject\bin\debug\omc.exe File: f:\sp\vctools\vc7libs\ship\atlmfc\include\atlsimpstr.h Line: 877 Expression: nLength <= GetData() -> nAllocLength For information on how your program can cause an assertion failure, see this Visual C++ documentation on asserts. ************************************************************************************************************ Debug Error! Program:d:\omc\OMC610_rajaratk_priv_view\omcproject\bin\debug\omc.exe HEAP CORRUPTED DETECTED: after Normal block(#45650) at 0x02E20BC8. CRT detected that the application wrote to memory after end of heap buffer. Memory allocated at f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp

                      D 1 Reply Last reply
                      0
                      • R rajaratk

                        It shows the following error messages: Debug Assertion Failed! Program: d:\omc\OMC610_rajaratk_priv_view\omcproject\bin\debug\omc.exe File: f:\sp\vctools\vc7libs\ship\atlmfc\include\atlsimpstr.h Line: 877 Expression: nLength <= GetData() -> nAllocLength For information on how your program can cause an assertion failure, see this Visual C++ documentation on asserts. ************************************************************************************************************ Debug Error! Program:d:\omc\OMC610_rajaratk_priv_view\omcproject\bin\debug\omc.exe HEAP CORRUPTED DETECTED: after Normal block(#45650) at 0x02E20BC8. CRT detected that the application wrote to memory after end of heap buffer. Memory allocated at f:\sp\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #14

                        rajaratk wrote:

                        Expression: nLength <= GetData() -> nAllocLength

                        From here you should be able to look at the stack frame to see how code execution got to line 877. It looks to be a string-related object.


                        "A good athlete is the result of a good and worthy opponent." - David Crow

                        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups