Sunday, October 25, 2009

Software bug

A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways. Most bugs arise from mistakes and errors made by people in either a program's source code or its design, and a few are caused by compilers producing incorrect code. A program that contains a large number of bugs, and/or bugs that seriously interfere with its functionality, is said to be buggy.

Common types of computer bugs

Conceptual error (code is syntactically correct, but the programmer or designer intended it to do something else)

Maths 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
  • 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. These bugs can form a security vulnerability.
  • Excessive recursion which though logically valid causes stack overflow

Co-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
How about some bugs for snacks?

1 comments:

krishna kashyap av said...

Cool information.
I think these bugs are
due to the guys who make
them..
Work from home India