A patch is a set of changes to a computer program or its supporting data designed to update, fix, or improve it. The majority of patches are provided by software vendors for operating system and application updates. Patches may be installed either under programmed control or by a human programmer using an editing tool or a debugger.
They may be applied to program files on a storage device, or in computer memory. Patches may be permanent until patched again or temporary. Patching makes possible the modification of compiled and machine language object programs when the source code is unavailable.
This demands a thorough understanding of the inner workings of the object code by the person creating the patch, which is difficult without close study of the source code. Someone unfamiliar with the program being patched may install a patch using a patch utility created by another person who is the Admin.
Even when the source code is available, patching makes possible the installation of small changes to the object program without the need to recompile or reassemble. For minor changes to software, it is often easier and more economical to distribute patches to users rather than redistributing a newly recompiled or reassembled program.
Although meant to fix problems, poorly designed patches can sometimes introduce new problems see software regressions. In some special cases updates may knowingly break the functionality or disable a device, for instance, by removing components for which the update provider is no longer licensed.
Patch management is a part of lifecycle managementand is the process of using a strategy and plan of what patches should be applied to which systems at a specified time. Patches for proprietary software are typically distributed as executable files instead of source code.
When executed these files load a program into memory which manages the installation of the patch code into the target program s on disk. Patches for other software are typically distributed as data files containing the patch code.
These are read by a patch utility program which performs the installation. This utility modifies the target program's executable file—the program's machine code —typically by overwriting its bytes with bytes representing the new patch code.
If the new code will fit in the space number of bytes occupied by the old code, it may be put in place by overwriting directly over the old code. This is called an inline patch. If the new code is bigger than the old code, the patch utility will append load record s containing the new code to the object file of the target program being patched.
When the patched program is run, execution is directed to the new code with branch instructions jumps or calls patched over the place in Hem och Hushåll old code where the new code is needed. The patch code must have place s in memory to be executed at runtime.
Inline patches are no difficulty, but when additional memory space is needed the programmer must improvise. Naturally if the patch programmer is the one who first created the code to be patched, this is easier.