Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Memory corruption

From Wikipedia, the free encyclopedia
(Redirected fromHeap corruption)
This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages)
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Memory corruption" – news ·newspapers ·books ·scholar ·JSTOR
(May 2016) (Learn how and when to remove this message)
This articlepossibly containsoriginal research. Pleaseimprove it byverifying the claims made and addinginline citations. Statements consisting only of original research should be removed.(June 2020) (Learn how and when to remove this message)
(Learn how and when to remove this message)
Program execution
General concepts
Types of code
Compilation strategies
Notable runtimes
Notable compilers & toolchains

Memory corruption occurs in acomputer program when the contents of amemory location are modified due to programmatic behavior that exceeds the intention of the originalprogrammer or program/language constructs; this is termed as violation ofmemory safety. The most likely causes of memory corruption areprogramming errors (software bugs). When the corrupted memory contents are used later in that program, it leads either to program crash or to strange and bizarre program behavior. Nearly 10% of application crashes on Windows systems are due toheap corruption.[1]

Modern programming languages likeC andC++ have powerful features of explicit memory management andpointer arithmetic. These features are designed for developing efficient applications and system software. However, using these features incorrectly may lead to memory corruption errors.

Memory corruption is one of the most intractable class of programming errors, for two reasons:

  1. The source of the memory corruption and its manifestation may be far apart, making it hard to correlate the cause and the effect.
  2. Symptoms appear under unusual conditions, making it hard to consistently reproduce the error.

Memory corruption errors can be broadly classified into four categories:

  1. Usinguninitialized memory: Contents of uninitialized memory are treated as garbage values. Using such values can lead to unpredictable program behavior.
  2. Using non-owned memory: It is common to use pointers to access and modify memory. If such a pointer is a null pointer,dangling pointer (pointing to memory that has already been freed), or to a memory location outside of current stack orheap bounds, it is referring to memory that is not then possessed by the program. Using such pointers is a serious programming flaw. Accessing such memory usually causes operating system exceptions, that most commonly lead to a program crash (unless suitable memory protection software is being used).
  3. Using memory beyond the memory that was allocated (buffer overflow): If an array is used in a loop, with incorrect terminating condition, memory beyond the array bounds may be accidentally manipulated. Buffer overflow is one of the most common programming flaws exploited by computer viruses, causing seriouscomputer security issues (e.g.return-to-libc attack,stack-smashing protection) in widely used programs. In some cases programs can also incorrectly access the memory before the start of a buffer.
  4. Faulty heap memory management:Memory leaks and freeing non-heap or un-allocated memory are the most frequent errors caused by faulty heap memory management.

Manymemory debuggers such asPurify,Valgrind,Insure++,Parasoft C/C++test,AddressSanitizer are available to detect memory corruption errors.

See also

[edit]

References

[edit]
  1. ^Radich, Q.; Sherer, T.; Sharkey, K.; Batchelor, D.; Kennedy, J. T.; Mabee, D.; Coulter, D.; Michael, S. (28 April 2021)."Application Verifier (Windows 7 and Windows Server 2008 R2 Application Quality Cookbook) - Win32 apps". Microsoft Developer Network. Retrieved2022-02-09.

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Memory_corruption&oldid=1166601706"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp