Common types of computer bugs
Common types of computer bugs
- Conceptual error (code is syntactically correct, but the programmer or designer intended it to do something else)
Arithmetic bugs
- Division by zero
- Arithmetic overflow or underflow
- Loss of arithmetic precision due to rounding or numerically unstable algorithms
Logic bugs
- Infinite loops and infinite recursion
- Off by one error, counting one too many or too few when looping
Syntax bugs
- Use of the wrong operator, such as performing assignment instead of equality test. In simple cases often warned by the compiler; in many languages, deliberately guarded against by language syntax
Resource bugs
- Null pointer dereference
- Using an uninitialized variable
- Using an otherwise valid instruction on the wrong data type (see packed decimal/binary coded decimal)
- Access violations
- Resource leaks, where a finite system resource such as memory or file handles are exhausted by repeated allocation without release.
- Buffer overflow, in which a program tries to store data past the end of allocated storage. This may or may not lead to an access violation or storage violation. These bugs can form a security vulnerability.
- Excessive recursion which though logically valid causes stack overflow
Multi-threading programming bugs
- Deadlock
- Race condition
- Concurrency errors in Critical sections, Mutual exclusions and other features of concurrent processing. Time-of-check-to-time-of-use (TOCTOU) is a form of unprotected critical section.
Teamworking bugs
- Unpropagated updates; e.g. programmer changes "myAdd" but forgets to change "mySubtract", which uses the same algorithm. These errors are mitigated by the Don't Repeat Yourself philosophy.
- Comments out of date or incorrect: many programmers assume the comments accurately describe the code
- Differences between documentation and the actual product
Bugs in popular culture
- In the 1968 novel 2001: A Space Odyssey (and the corresponding 1968 film), a spaceship's onboard computer, HAL 9000, attempts to kill all its crew members. In the followup 1982 novel, 2010: Odyssey Two, and the accompanying 1984 film, 2010, it is revealed that this action was caused by the computer having been programmed with two conflicting objectives: to fully disclose all its information, and to keep the true purpose of the flight secret from the crew; this conflict caused HAL to become paranoid and eventually homicidal.
- In the 1984 song 99 Red Balloons (though not in the original German version), "bugs in the software" lead to a computer mistaking a group of balloons for a nuclear missile and starting a nuclear war.
- The 2004 novel The Bug, by Ellen Ullman, is about a programmer's attempt to find an elusive bug in a database application.
No comments:
Post a Comment