Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Collection of exception handling for VC program crash

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1 Run-Time Check Failure: being used without being defined

Scene

Pass an uninitialized structure as an argument to a function, and the above error occurs at run time. Although it is not used in the function, it still needs to initialize the structure and reiterate the importance of initialization.

2 Run-Time Check Failure Stack around the variable'xxx'was corrupted

Scene

Look for all references to xxx and scrutinize any of the possible array out-of-bounds problems that often occur:

one

Char szName [10] = {"hello,world"}

Char szCopy [8] = {0}

Strcpy (szCopy, szName)

two

Char szStr [2] = {0}

Sprintf (szStr, "d", 12)

Then the length of the data written to szStr should be 3 (please don't forget'\ 0'), char [2] is not enough, it will cause cross-boundary access.

3 buffer overflow occurred when the internal state of the program was corrupted

Scene

The release version enables maximum speed O2 and has no problem running. When optimizing Od is disabled, the following error occurs: a buffer overflow occurs in test.exe that has corrupted the internal state of the program. The problem is not when the code is executed, but when the program exits and the system cleans up. The stack terminal called at this time is the following code: the interrupt is at line 298 of the gs_report.c file (_ CRT_DEBUGGER_HOOK (_ CRT_DEBUGGER_GSFAILURE), as follows:

# if defined (_ CRTBLD) & &! defined (_ SYSCRT)

DebuggerWasPresent = IsDebuggerPresent ()

_ CRT_DEBUGGER_HOOK (_ CRT_DEBUGGER_GSFAILURE)

# endif

It is not an exception that occurs when the user code is executed.

Solution idea

Block the code from back to front to find the source of the problem.

The root of the problem

Navigating to an object that generates a class on the stack can cause this problem. Sizeof class, the length value is 1257, the function is big data's search, it is this class that causes the stack to overflow, so the problem is solved by using dynamic new objects.

4 unresolved external symbol _ _ ImageBase

ErrorLNK2001: unparsed external symbol _ ImageBase LIBCMT.lib

ErrorLNK2001: unparsed external symbol _ ImageBase LIBCMT.lib

Solve

Project platform: Win32

WindowsCE (/ SUBSYSTEM:WINDOWSCE) is selected in the linker > system > > subsystem

It should be Windows (/ SUBSYSTEM:WINDOWS)

5 this application has requested the runtime to terminateit in an unusual way

Program crashes pop-up window this application has requested the runtime to terminate it inan unusual way.

Please contact the aplication's supportteam for more information

Try the scheme

Cd% windir%\ system32

Regsvr32 Msxml3.dll

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report