Defensive programming: Difference between revisions

Content deleted Content added
Line 120:
* Legacy code may have been written and tested under conditions which no longer apply. The old quality assurance tests may have no validity any more.
** '''Example 1''': legacy code may have been designed for ASCII input but now the input is UTF-8.
** '''Example 2''': legacy code may have been compiled and tested on 32-bit architectures, but when compiled on 64-bit architectures, new arithmetic problems may occur (e.g., invalid signedness tests, invalid type casts, etc.).
** '''Example 3''': legacy code may have been targeted for offline machines, but becomes vulnerable once network connectivity is added.
* Legacy code is not written with new problems in mind. For example, source code written about 1990 is likely to be prone to many [[code injection]] vulnerabilities, because most such problems were not widely understood at that time.