This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
This article needs additional citations for verification. Please help improve this article by adding 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 article possibly contains original research. Please improve it by verifying the claims made and adding inline 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
Code
Translation
Compiler
Compile time
Optimizing compiler
Intermediate representation (IR)
Execution
Runtime system
Runtime
Executable
Interpreter
Virtual machine
Types of code
Source code
Object code
Bytecode
Machine code
Microcode
Compilation strategies
Ahead-of-time (AOT)
Just-in-time (JIT)
Tracing just-in-time
Compile and go system
Precompilation
Transcompilation
Recompilation
Notable runtimes
Android Runtime (ART)
BEAM
Common Language Runtime (CLR) and Mono
CPython and PyPy
crt0
Java virtual machine (JVM)
LuaJIT
Objective-C and Swift's
V8 and Node.js
Zend Engine
TempleOS
Notable compilers & toolchains
GNU Compiler Collection (GCC)
LLVM and Clang
MSVC
v
t
e
Memory corruption occurs in a computer program when the contents of a memory location are modified due to programmatic behavior that exceeds the intention of the original programmer or program/language constructs; this is termed as violation of memory safety. The most likely causes of memory corruption are programming 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 to heap corruption.[1]
Modern programming languages like C and C++ have powerful features of explicit memory management and pointer 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:
The source of the memory corruption and its manifestation may be far apart, making it hard to correlate the cause and the effect.
Symptoms appear under unusual conditions, making it hard to consistently reproduce the error.
Memory corruption errors can be broadly classified into four categories:
Using uninitialized memory: Contents of uninitialized memory are treated as garbage values. Using such values can lead to unpredictable program behavior.
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 or heap 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).
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 serious computer 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.
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.
Many memory debuggers such as Purify, Valgrind, Insure++, Parasoft C/C++test, AddressSanitizer are available to detect memory corruption errors.
^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. Retrieved 2022-02-09.
Memorycorruption occurs in a computer program when the contents of a memory location are modified due to programmatic behavior that exceeds the intention...
code memory (ECC memory) is a type of computer data storage that uses an error correction code (ECC) to detect and correct n-bit data corruption which...
Corruption is a form of dishonesty or a criminal offense which is undertaken by a person or an organization which is entrusted in a position of authority...
termination in most environments, but can cause corruption in operating system kernels or systems without memory protection, or when use of the null pointer...
computer security technique involved in preventing exploitation of memorycorruption vulnerabilities. In order to prevent an attacker from reliably redirecting...
which mitigates exploitation techniques such as those involving memorycorruption, Jump-Oriented-Programming, and Return-Oriented-Programming. The A12...
values that each thread was attempting to write; this could result in memorycorruption if the resulting value is one that neither thread attempted to write...
technique of preventing memorycorruption attacks such as buffer overflows. It involves placing data in randomly selected locations in memory in order to make...
the information arriving in the systems memory is corrupted and can cause unpredictable results. Data corruption during transmission has a variety of causes...
AddressSanitizer (or ASan) of 2012, which uses directly mapped shadow memory to detect memorycorruption such as buffer overflows or accesses to a dangling pointer...
this problem, and the result will usually be a crash or data- or memorycorruption at runtime. Although name mangling is not generally required or used...
original on 2018-12-06. Retrieved 2019-03-17. "What Causes Flash MemoryCorruption?". SecureDataRecovery. Archived from the original on 2020-07-28. Retrieved...
terms RAM, main memory or primary storage. Archaic synonyms for main memory include core (for magnetic core memory) and store. Main memory operates at a...
Corruption in India is an issue which affects economy of central, state, and local government agencies. Corruption is blamed for stunting the economy of...
Dynamic memory error debugger for C, C++, and Fortran applications that run on Windows and Linux. Purify: Mainly memorycorruption detection and memory leak...
Mac OS X. Nils hacked Firefox 3.6 on Windows 7 64-bit by using a memorycorruption vulnerability and bypass ASLR and DEP, after which Mozilla patched...
to the handler's side effect of memorycorruption. If the stack is exceeded into a non-writable (or protected) memory area, the failure will usually occur...
the running kernel, preventing privilege escalation attacks using memorycorruption) Recent research has shown what can effectively provide protection...
Windows Defender scanned a specially crafted file, it would lead to memorycorruption, potentially allowing an attacker to control the affected machine...
to be shared across domains, callbacks can be problematic, and any memorycorruption bugs in one domain is likely to corrupt other domains. ".NET Framework...
Flash memory is an electronic non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash...