← New search

Other meanings of Software bug

Computing

Software bug

A software bug is an error, flaw, or fault in a computer program that causes it to produce an incorrect or unexpected result, or to behave in unintended ways. Bugs arise from mistakes in design, coding, or logic, and can range from minor glitches to catastrophic system failures.

1947
First recorded bug
Moth found in Harvard Mark II
~50%
of code defects
attributed to logic errors
$2.41T
global cost of bugs
in 2023 (CISQ estimate)
1

Definition and types

▶

A software bug is a defect that causes a program to behave unexpectedly. Bugs are typically classified by their nature: syntax errors (violations of language rules), logic errors (incorrect algorithms or conditions), runtime errors (crashes or exceptions), and semantic errors (unintended behavior that does not crash).1

Bugs can also be categorized by impact: security vulnerabilities (e.g., buffer overflows), performance issues (e.g., memory leaks), and functional defects (e.g., incorrect output). Some bugs are intermittent, occurring only under specific conditions, making them notoriously difficult to reproduce and fix.2

2

Historical origins

▶

The term "bug" predates computers; in engineering, it referred to mechanical defects. The first recorded computer bug was a moth found in the Harvard Mark II electromechanical computer in 1947, taped into the logbook by Grace Hopper's team.3 The term "debugging" was used earlier, but the moth incident popularized it.

Early software bugs were often hardware-related, but as software grew in complexity, logic errors became dominant. The 1960s saw the first major software crises, such as the Mariner 1 spacecraft failure in 1962, caused by a missing hyphen in a guidance equation.4

3

Causes and prevention

▶

Bugs originate from human error, miscommunication, or incomplete requirements. Common causes include off-by-one errors, race conditions, and improper handling of edge cases. Software testing aims to detect bugs before release, using methods like unit testing, integration testing, and fuzzing.5

Preventive practices include code reviews, static analysis, formal verification, and test-driven development. Despite these, bugs remain inevitable due to the complexity of modern systems; the 2017 Boeing 737 MAX crashes were linked to a software bug in the MCAS system.6

4

Notable bugs and their impact

▶

Some bugs have had profound consequences. The Y2K bug (1999) threatened global systems due to two-digit year storage, prompting massive remediation. The Ariane 5 rocket explosion in 1996 was caused by an integer overflow in inertial navigation software.

In 2018, the Marriott data breach exposed 500 million records due to a security bug. The Heartbleed vulnerability (2014) in OpenSSL allowed attackers to read memory, affecting millions of websites.7

5

Lesser-known aspects

▶

Beyond headline bugs, there are obscure but real phenomena. Heisenbugs change behavior when observed, often due to timing. Mandelbugs are complex, non-deterministic defects. Bohrbugs are deterministic and easy to reproduce.2

The first bug in a commercial computer was in the UNIVAC I (1951), a hardware issue. In 1962, the Mariner 1 bug was a missing hyphen, but the spacecraft was destroyed by range safety. The Pentium FDIV bug (1994) cost Intel $475 million in replacements. The NASA Mars Climate Orbiter (1999) was lost due to a metric/imperial unit mismatch.4

≡

Glossary

▶
Heisenbug
A bug that disappears or alters behavior when an attempt is made to observe it, often due to timing or optimization.
Mandelbug
A bug whose causes are so complex that its behavior appears chaotic or non-deterministic.
Bohrbug
A deterministic bug that reliably reproduces under the same conditions.
Off-by-one error
A logic error where a loop iterates one time too many or too few, often due to boundary condition mistakes.

The term 'bug' was popularized by Grace Hopper, but the concept of software defects predates the term.